Skip to content

Commit

Permalink
feat: automate gsheet publication (#299)
Browse files Browse the repository at this point in the history
* feat: automate google sheets update

* feat: automate google sheets update

* feat: automate google sheets update

* feat: automate google sheets update

* build: pass secrets

* build: update workflow

* build: test google sheets step
  • Loading branch information
setchy authored Apr 9, 2024
1 parent c54919d commit 8f69e8a
Show file tree
Hide file tree
Showing 13 changed files with 452 additions and 39 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/data-refresh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,23 @@ jobs:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4

- uses: pnpm/action-setup@v3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
version: 8
node-version-file: '.nvmrc'

- name: Install Dependencies
run: |
pnpm install
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
run_install: true

- name: Refresh Radar Datasets
run: |
pnpm start
env:
GOOGLE_SHEET_ID: ${{ secrets.GOOGLE_SHEET_ID }}
GOOGLE_CLIENT_EMAIL: ${{ secrets.GOOGLE_CLIENT_EMAIL }}
GOOGLE_PRIVATE_KEY: ${{ secrets.GOOGLE_PRIVATE_KEY }}

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/google-sheets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Google Sheets Sync

on:
workflow_dispatch: # This allows manual triggering from the GitHub Actions UI.

jobs:
refresh:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'

- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
run_install: true

- name: Update Google Sheets
run: |
pnpm start -v google-sheets
env:
GOOGLE_SHEET_ID: ${{ secrets.GOOGLE_SHEET_ID }}
GOOGLE_CLIENT_EMAIL: ${{ secrets.GOOGLE_CLIENT_EMAIL }}
GOOGLE_PRIVATE_KEY: ${{ secrets.GOOGLE_PRIVATE_KEY }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
node_modules/
dist/
temp/
temp/

config/.env
credentials.json
4 changes: 4 additions & 0 deletions config/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Google Sheets Publishing
GOOGLE_SHEET_ID=<some sheet id>
GOOGLE_CLIENT_EMAIL=<some client email>
GOOGLE_PRIVATE_KEY=<some private key>
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
"@types/lodash": "4.17.0",
"@types/node": "20.12.6",
"commander": "12.0.0",
"dotenv": "16.4.5",
"googleapis": "134.0.0",
"jsdom": "24.0.0",
"lodash": "4.17.21",
"puppeteer": "22.6.3",
"ts-node": "10.9.2",
"typescript": "5.4.4"
},

"engines": {
"node": "20"
},

"packageManager": "[email protected]"
}
Loading

0 comments on commit 8f69e8a

Please sign in to comment.