python3.10 -m venv .testing
source .testing/bin/activate
pip install -r requirements.txt
Also need JSON authorization file from Google Cloud Platform.
Creating a Google Cloud Service Account:
- Go to the Google Cloud Console.
- Create a new project: Click on the project drop-down and select
New Project
, then fill in theProject name
field and clickCreate
. - Enable the Google Sheets API: Navigate to
APIs & Services > Library
, search forGoogle Sheets API
and click on it. In the Google Sheets API page, clickEnable
. - Create credentials: Navigate to
APIs & Services > Credentials
, clickCreate Credentials
and selectService account
. Fill in theService account name
andService account description
fields and clickCreate
. - Grant this service account access to project: In the
Role
field, selectProject > Editor
(orProject > Viewer
). ClickContinue
.
Creating a key:
- Create key: In the
Service account
details page, clickAdd Key
, thenCreate new key
. SelectJSON
as the key type and clickCreate
. Your JSON key file will be downloaded. - Share your Google Spreadsheet: Open your Google Spreadsheet, click on
Share
, and paste theclient_email
from the JSON key file (or theDetails
page). ClickDone
.
Rotating a key:
- Disable any previous keys.
- Go through the
Add Key
process again. - You should not need to re-share the Google Spreadsheet, as the email should be the same.
Convert the JSON key to a string, to be used in Github Actions:
jq -c . <path-to-json-key-file>
Add the string as a secret in GitHub:
- Go to your GitHub repository and click on
Settings
(admin rights needed) - Click on
Secrets
in the left sidebar. - Click on
New repository secret
. - Enter a name for the secret in the
Name
field. This will be the name of the environment variable that holds the JSON contents. - Paste the string you copied into the
Value
field. - Click on
Add secret
.
Or simply run
jq -c . auth.json | base64 | gh secret set -a actions GC_JSON