Github Action to continuously export issues and pull requests data to a Google Spreadsheet
A project initiated by ViRGiL175 with contributions from Lityx.
Create a Github Action workflow as follow:
name: sync-issues-spreadsheet
on:
workflow_dispatch:
issues:
types:
[
opened,
deleted,
transferred,
closed,
reopened,
assigned,
unassigned,
labeled,
unlabeled,
]
jobs:
spreadsheet-sync:
runs-on: ubuntu-latest
name: sync-issues-spreadsheet
steps:
- name: sync-issues-spreadsheet
id: spreasheet-sync
uses: noelmace/spreadsheet-sync@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
google-api-service-account-credentials: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_DATA }}
document-id: "<YOUR SPREADSHEET ID>"
sheet-name: "<NAME OF THE SHEET WHEN DATA WILL BE EXPORTED>"
mode: "issues"
Don't forget to fulfill the requirements.
key | description | mandatory |
---|---|---|
google-api-service-account-credentials |
Google service account credentials (JSON) | yes |
document-id |
ID of your Google Spreadsheet | yes |
sheet-name |
name of the sheet to export to | yes |
mode |
sync mode to use | no (all by default) |
Possible values for the mode
option are:
all
: export all issues and PRsissues
: export issues only (exclude pull requests)milestone_issues
: only export issues associated with an active milestone
Open Google IAM & Admin and Create a Google Cloud Project if you don't have one.
Select this project, create service account credentials, and save the associated JSON
Finally, you need to enable the API by visiting https://console.cloud.google.com/apis/library/sheets.googleapis.com to avoid an accessNotConfigured
error. Make sure to select the right user and project before clicking on the "enable" button.
Store these JSON Credentials in an Encrypted Secret for your Github repository (cf. the google-api-service-account-credentials
option).
The
GITHUB_TOKEN
secret is set by default, so you don't need to define one. Owerver, you still need to pass it as an environement variable to the Github job usingenv
as shown in the example worflow.
Create a new (or open an existing) spreadsheet document and note its ID (the part of the URL between /d/
and /edit
). Use this ID for the document-id
option.
Create a dedicated sheet for GitHub Issues data (cf. the sheet-name
option).
Add the Google API Service Account email to your document with editor access.