From 63ade7f84a68bb4c7d82b2a2e120de122cacc8ce Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Mon, 13 May 2024 22:04:59 +0200 Subject: [PATCH 1/7] Updated job name --- .github/workflows/update-rss.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-rss.yml b/.github/workflows/update-rss.yml index 7d4f3ed..3017058 100644 --- a/.github/workflows/update-rss.yml +++ b/.github/workflows/update-rss.yml @@ -9,7 +9,7 @@ on: - cron: "0 0 * * *" # Run every day at midnight jobs: - build: + generate-rss: runs-on: ubuntu-latest steps: From 30b36271adbdd885dd58b0076b67318f98b8959f Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Mon, 13 May 2024 22:06:03 +0200 Subject: [PATCH 2/7] Cat rss file, also disable file read --- .github/workflows/update-rss.yml | 3 +++ rss.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-rss.yml b/.github/workflows/update-rss.yml index 3017058..bf77985 100644 --- a/.github/workflows/update-rss.yml +++ b/.github/workflows/update-rss.yml @@ -26,3 +26,6 @@ jobs: - name: List Directory run: ls -l + + - name: Cat rss file + run: cat rss.xml diff --git a/rss.js b/rss.js index d4723b2..ef1bd48 100644 --- a/rss.js +++ b/rss.js @@ -8,7 +8,7 @@ class RSS { this.filename = 'rss.xml'; this.feed = null; - this.read() + // this.read() } // reads RSS file From 01560f5d8598a5565abd0ff4f7dd00390ad448fb Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Mon, 13 May 2024 22:22:33 +0200 Subject: [PATCH 3/7] gcloud auth and bucket upload of rss file --- .github/workflows/update-rss.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/update-rss.yml b/.github/workflows/update-rss.yml index bf77985..e8a070c 100644 --- a/.github/workflows/update-rss.yml +++ b/.github/workflows/update-rss.yml @@ -12,9 +12,13 @@ jobs: generate-rss: runs-on: ubuntu-latest + permissions: + contents: 'read' + id-token: 'write' + steps: - name: Checkout Repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install Node.js uses: actions/setup-node@v2 @@ -24,8 +28,13 @@ jobs: - name: Run Script run: node run.js - - name: List Directory - run: ls -l + - id: 'auth-to-gcloud' + uses: 'google-github-actions/auth@v2' + with: + credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}' - - name: Cat rss file - run: cat rss.xml + - id: 'upload-rss-file' + uses: 'google-github-actions/upload-cloud-storage@v2' + with: + path: 'rss.xml' + destination: 'miljobilen-rss' From b9e6ea7ff1a7306385c913112627a77f2aa1166e Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Mon, 13 May 2024 22:30:20 +0200 Subject: [PATCH 4/7] Updated setup-node action to v4 --- .github/workflows/update-rss.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-rss.yml b/.github/workflows/update-rss.yml index e8a070c..08716a1 100644 --- a/.github/workflows/update-rss.yml +++ b/.github/workflows/update-rss.yml @@ -21,7 +21,7 @@ jobs: uses: actions/checkout@v4 - name: Install Node.js - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: node-version: '21' From 464ed254d9c9554758350a94b5869df87acdb6ca Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Mon, 13 May 2024 22:32:17 +0200 Subject: [PATCH 5/7] Define process_gcloudignore variable as false --- .github/workflows/update-rss.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-rss.yml b/.github/workflows/update-rss.yml index 08716a1..c672d92 100644 --- a/.github/workflows/update-rss.yml +++ b/.github/workflows/update-rss.yml @@ -38,3 +38,4 @@ jobs: with: path: 'rss.xml' destination: 'miljobilen-rss' + process_gcloudignore: false From ee58951e66c93a52e3c2cc11286cdc8a52b9b84f Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Mon, 13 May 2024 22:41:23 +0200 Subject: [PATCH 6/7] Moved source files into folder --- .github/workflows/update-rss.yml | 2 +- README.md | 1 + rss.js => src/rss.js | 0 run.js => src/run.js | 0 utils.js => src/utils.js | 0 5 files changed, 2 insertions(+), 1 deletion(-) rename rss.js => src/rss.js (100%) rename run.js => src/run.js (100%) rename utils.js => src/utils.js (100%) diff --git a/.github/workflows/update-rss.yml b/.github/workflows/update-rss.yml index c672d92..1add039 100644 --- a/.github/workflows/update-rss.yml +++ b/.github/workflows/update-rss.yml @@ -26,7 +26,7 @@ jobs: node-version: '21' - name: Run Script - run: node run.js + run: node src/run.js - id: 'auth-to-gcloud' uses: 'google-github-actions/auth@v2' diff --git a/README.md b/README.md index 9c3ea18..f27b296 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ This is such a shitshow. Smaller tasks: - [ ] Connect to Google bucket, SA, etc. - [ ] Updates RSS generation + - [ ] Compare existing dates in RSS to fetched ### Handle rollover of date list diff --git a/rss.js b/src/rss.js similarity index 100% rename from rss.js rename to src/rss.js diff --git a/run.js b/src/run.js similarity index 100% rename from run.js rename to src/run.js diff --git a/utils.js b/src/utils.js similarity index 100% rename from utils.js rename to src/utils.js From 3d9cee1f471f9e08ee31fd80be374a623641321d Mon Sep 17 00:00:00 2001 From: Kevin Midboe Date: Mon, 13 May 2024 22:45:28 +0200 Subject: [PATCH 7/7] updated todo list --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f27b296..dfda073 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,10 @@ Runs every day and checks for and updates RSS with next pickup date relative to This is such a shitshow. Smaller tasks: - - [ ] Connect to Google bucket, SA, etc. + - [x] Connect to Google bucket, SA, etc. - [ ] Updates RSS generation - [ ] Compare existing dates in RSS to fetched + - [ ] alert on failing run ### Handle rollover of date list