-
Notifications
You must be signed in to change notification settings - Fork 2
Add github action to google sheet tracking #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ashley314
wants to merge
21
commits into
master
Choose a base branch
from
feature/helpdesk_sheet_actions
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
dbc06a8
add gsheet tracking as action
ashley314 cc23fdc
add story point column
ashley314 eab8cf1
use env var for sheet id
ashley314 5ece345
add sheet id
ashley314 6a5332f
add maintainer info to sheet
ashley314 dc1014a
add default assignee and full resolution description
ashley314 16879d2
reformat spreadsheet
ashley314 beabb46
setup.md updated for columns
ashley314 8e9e8e2
better template matching
ashley314 3dce908
update story point collection
ashley314 dcace60
update autoassign only at open/labeled events
ashley314 d8279f9
only read full sheet once
ashley314 7840910
cancel in progress, add retry
ashley314 7f99b94
use helper function for section body
ashley314 bfa08e9
fix old info edge case
ashley314 2a229a6
environ updated
ashley314 3a69ae3
Apply suggestions from code review
ashley314 cf272ac
add comment, catch ValueError
ashley314 17b30bf
use batch_requests
ashley314 61c08ec
use retry helper func
ashley314 b457460
update request org and direct match
ashley314 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,211 @@ | ||
| # Helpdesk Sheet Sync — Setup & Test Guide | ||
|
|
||
| ## Overview | ||
|
|
||
| This guide walks through setting up and testing the Google Sheets integration | ||
| for the JCSDA helpdesk system. On each helpdesk issue event (open, edit, close, | ||
| etc.) a GitHub Actions workflow syncs issue data to a shared Google Sheet. | ||
|
|
||
| --- | ||
|
|
||
| ## Step 1 — Google Cloud: create the service account (~15 min) | ||
|
ashley314 marked this conversation as resolved.
|
||
|
|
||
| 1. Go to [console.cloud.google.com](https://console.cloud.google.com) | ||
| 2. Create a new project (e.g., `jcsda-helpdesk`) or select an existing one | ||
| 3. **Enable APIs**: Navigation menu → APIs & Services → Library | ||
| - Search and enable **Google Sheets API** | ||
| - Search and enable **Google Drive API** | ||
| 4. **Create service account**: IAM & Admin → Service Accounts → **+ Create Service Account** | ||
| - Name: `jcsda-helpdesk-sheets` | ||
| - Skip project role (click through) — permissions come from the Sheet itself | ||
| - Click **Done** | ||
| 5. Click the new service account → **Keys** tab → **Add Key → Create new key → JSON** | ||
| - Save the downloaded `.json` file somewhere temporarily (you will paste it into GitHub next) | ||
| - Note the service account **email address** | ||
| (e.g., `jcsda-helpdesk-sheets@your-project.iam.gserviceaccount.com`) | ||
|
|
||
| --- | ||
|
|
||
| ## Step 2 — Create the Google Sheet (~5 min) | ||
|
|
||
| 1. Go to [sheets.google.com](https://sheets.google.com) → create a **Blank** spreadsheet | ||
| 2. Name it `JCSDA Helpdesk Tracker` | ||
| 3. **Share it with the service account**: Share button → paste the service account | ||
| email → set to **Editor** → Send | ||
| 4. Copy the **Sheet ID** from the URL bar: | ||
| ``` | ||
| https://docs.google.com/spreadsheets/d/THIS_LONG_STRING_IS_THE_ID/edit | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Step 3 — Configure the Sheet ID and add the GitHub Secret | ||
|
|
||
| **Sheet ID** — open `.github/workflows/helpdesk-sheet-sync.yml` and paste your | ||
| Sheet ID into the `HELPDESK_SHEET_ID` variable at the top of the file: | ||
|
|
||
| ```yaml | ||
| env: | ||
| HELPDESK_SHEET_ID: "YOUR_SHEET_ID_HERE" | ||
| ``` | ||
|
|
||
| **Secret** — go to `github.com/JCSDA-internal/.github/settings/secrets/actions` | ||
| and add one secret: | ||
|
|
||
| | Name | Value | | ||
| |---|---| | ||
| | `GOOGLE_SERVICE_ACCOUNT_JSON` | Paste the **entire contents** of the downloaded `.json` key file | | ||
|
|
||
| --- | ||
|
|
||
| ## Step 4 — Add a test entry to the org map | ||
|
|
||
| In [org_assignee_map.json](org_assignee_map.json), add at least one real | ||
| org/username pair so you can verify auto-assignment works. Leave the rest as | ||
| placeholders for now. | ||
|
|
||
| ```json | ||
| { | ||
| "NOAA/NWS/EMC": "real-github-username", | ||
| ... | ||
| } | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Step 5 — Open the PR | ||
|
|
||
| Push the branch containing the following files and open a PR in `JCSDA-internal/.github`: | ||
|
|
||
| ``` | ||
| .github/workflows/helpdesk-sheet-sync.yml ← new | ||
| .github/workflows/helpdesk-triage-labels.yml ← bug fix | ||
| .github/scripts/helpdesk_sheet_sync.py ← new | ||
| .github/helpdesk/org_assignee_map.json ← new | ||
| .github/helpdesk/SETUP.md ← this file | ||
| .github/ISSUE_TEMPLATE/config.yaml ← updated | ||
| ``` | ||
|
|
||
| > **Note:** `issues` event workflows only run from the **default branch**. | ||
| > The Actions tab will show the workflow files during PR review, but the | ||
| > triggers will not fire until the PR is merged. This is expected behavior. | ||
|
|
||
| --- | ||
|
|
||
| ## Step 6 — Merge and create the `helpdesk` label | ||
|
|
||
| After merging, confirm the `helpdesk` label exists in the repo (the issue | ||
| template references it). Check `github.com/JCSDA-internal/.github/labels` — | ||
| if it is not there, create it manually with any color. | ||
|
|
||
| --- | ||
|
|
||
| ## Step 7 — Open a test issue | ||
|
|
||
| Go to `github.com/JCSDA-internal/.github/issues/new/choose` → select | ||
| **Helpdesk Request** and fill in every required field. Use a **Requesting | ||
| Organization** value that matches your test entry in `org_assignee_map.json` | ||
| to verify auto-assignment. | ||
|
|
||
| --- | ||
|
|
||
| ## Step 8 — Verify | ||
|
|
||
| **GitHub Actions** (`github.com/JCSDA-internal/.github/actions`): | ||
| - `Helpdesk → Google Sheet sync` should show a completed run | ||
| - Log should contain: `Appended new row for issue #N in JCSDA-internal/.github` | ||
| - `Helpdesk triage → labels` should also show a completed run | ||
|
|
||
| **GitHub issue:** | ||
| - The configured liaison should appear as assignee | ||
| - Labels `helpdesk` and any `triage:*` labels should be applied | ||
|
|
||
| **Google Sheet:** | ||
| - Row 1 should be a frozen, locked section-header row (auto-created on first run), | ||
| with four merged, labelled bands: **Ticket Information** | **Requester Information** | | ||
| **Work Tracking** | **Maintainer Notes** | ||
| - Row 2 should be a frozen, locked column-header row | ||
| - Row 3 should have all issue fields populated | ||
| - Column D (`url`) should display `#N` as a clickable hyperlink | ||
|
|
||
| **Close the test issue** and re-check the sheet: | ||
| - `status` → `Closed` | ||
| - `closed_at` → timestamp | ||
| - `time_to_close_days` → a decimal number | ||
|
|
||
| --- | ||
|
|
||
| ## Sheet columns reference | ||
|
|
||
| Row 1 carries merged section banners (locked). Row 2 carries the column headers | ||
| (locked). Data begins at row 3. | ||
|
|
||
| ### Ticket Information (A–E) | ||
|
|
||
| | Col | Name | Source | | ||
| |-----|------|--------| | ||
| | A | `issue_number` | Issue number — composite key with B | | ||
| | B | `repo` | `owner/repo` — composite key with A | | ||
| | C | `title` | Issue title | | ||
| | D | `url` | `=HYPERLINK()` formula — renders as clickable `#N` | | ||
| | E | `labels` | Comma-separated label names | | ||
|
|
||
| ### Requester Information (F–L) | ||
|
|
||
| | Col | Name | Source | | ||
| |-----|------|--------| | ||
| | F | `opened_by` | Issue author login | | ||
| | G | `opened_at` | ISO timestamp | | ||
| | H | `requesting_org` | Form field: *Requesting Organization* | | ||
| | I | `category` | Form field: *Issue category* | | ||
| | J | `impact` | Form field: *Impact / priority* | | ||
| | K | `reproducibility` | Form field: *Reproducibility* | | ||
| | L | `platform` | Form field: *Platform / system* | | ||
|
|
||
| ### Work Tracking (M–Q) | ||
|
|
||
| | Col | Name | Source | | ||
| |-----|------|--------| | ||
| | M | `assignees` | Comma-separated assignee logins | | ||
| | N | `status` | `Open` or `Closed` | | ||
| | O | `closed_at` | ISO timestamp, blank if open | | ||
| | P | `time_to_close_days` | Decimal days from open to close, blank if open | | ||
| | Q | `story_points` | Estimate field from GitHub Projects v2 | | ||
|
|
||
| ### Maintainer Notes (R–U) | ||
|
|
||
| | Col | Name | Source | | ||
| |-----|------|--------| | ||
| | R | `triage_category` | Checked items under *Triage Category / Maintainer Classification* | | ||
| | S | `root_cause` | Checked items under *Root Cause* | | ||
| | T | `resolution_description` | Form field: *Resolution Description* | | ||
| | U | `notes` | **Manually maintained — never overwritten by automation** | | ||
|
|
||
| --- | ||
|
|
||
| ## Credential security notes | ||
|
|
||
| - The service account has no GCP project roles — its only access is the single | ||
| Sheet it was shared on | ||
| - The `drive.file` OAuth scope used by the script limits it to files the service | ||
| account created or was explicitly shared on; it cannot browse Drive | ||
| - Rotate the service account key periodically via GCP IAM & Admin → Service Accounts | ||
| - For production use, replace the JSON key with **Workload Identity Federation** | ||
| (no long-lived credentials) — see Google's | ||
| [GitHub Actions OIDC guide](https://cloud.google.com/blog/products/identity-security/enabling-keyless-authentication-from-github-actions) | ||
|
|
||
| --- | ||
|
|
||
| ## Expanding to org-wide coverage (Option B) | ||
|
|
||
| Currently all helpdesk tickets must be filed in `JCSDA-internal/.github` | ||
| because GitHub Actions workflows only fire for events in the repo they live in. | ||
| Partners in other repos are directed here via the `contact_links` entry in | ||
| `ISSUE_TEMPLATE/config.yaml`. | ||
|
|
||
| When moving to full operational use, the plan is to add an **org-level | ||
| webhook** routing `issues` events to an AWS Lambda (following the existing | ||
| pattern in `github-admin/webhooks/`). This will allow tickets to be filed in | ||
| any JCSDA-Internal repo while still syncing to the same sheet. The `repo` | ||
| column already in the spreadsheet schema handles the multi-repo case without | ||
| any schema changes. | ||
|
ashley314 marked this conversation as resolved.
ashley314 marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "_readme": "Map partner organization names to their JCSDA GitHub liaison username. Keys are matched case-insensitively and exactly against the drop-down 'Requesting Organization' field. Unmatched values fall back to default_assignee.", | ||
|
|
||
| "default_assignee": "gibbsp", | ||
|
|
||
| "CADRE": "xian22", | ||
| "NRL-FALCON": "fcvdb", | ||
| "NRL-Space Weather": "fcvdb", | ||
| "OAR-RRFS": "ncrossette", | ||
| "OAR-EPIC": "gibbsp", | ||
| "MMM": "BenjaminRuston", | ||
| "NASA": "ytremolet", | ||
| "NESDIS": "BenjaminRuston", | ||
| "NWS": "ytremolet", | ||
| "UKMO": "ytremolet", | ||
| "USAF": "BenjaminRuston", | ||
| "Other": "gibbsp" | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These steps are already completed. The notes here are so we can do it again if needed.