From b5b14f3c23bf990d448202fb910890d95112f35d Mon Sep 17 00:00:00 2001 From: tuutti Date: Thu, 10 Oct 2024 06:56:26 +0300 Subject: [PATCH 1/3] UHF-10248: Use scoped token to trigger create pull request action --- .github/workflows/update-config.yml.dist | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-config.yml.dist b/.github/workflows/update-config.yml.dist index 1a7d61f..b40acb0 100644 --- a/.github/workflows/update-config.yml.dist +++ b/.github/workflows/update-config.yml.dist @@ -77,6 +77,7 @@ jobs: uses: peter-evans/create-pull-request@v6 with: commit-message: Update configuration + token: ${{ secrets.AUTOMATIC_UPDATE_TOKEN }} title: Automatic update labels: auto-update body: | From 634877daf2371234c2636e6a78a2832feffa4b43 Mon Sep 17 00:00:00 2001 From: tuutti Date: Thu, 10 Oct 2024 07:19:32 +0300 Subject: [PATCH 2/3] UHF-10248: Make sure secrets exist, updated documentation --- .github/workflows/update-config.yml.dist | 6 ++++++ documentation/automatic-updates.md | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-config.yml.dist b/.github/workflows/update-config.yml.dist index b40acb0..d36258d 100644 --- a/.github/workflows/update-config.yml.dist +++ b/.github/workflows/update-config.yml.dist @@ -24,6 +24,12 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Check if required secrets are set + env: + AUTOMATIC_UPDATE_TOKEN: ${{ secrets.AUTOMATIC_UPDATE_TOKEN }} + if: env.AUTOMATIC_UPDATE_TOKEN == '' + run: exit 1 + - name: Download latest dump env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/documentation/automatic-updates.md b/documentation/automatic-updates.md index 7c5e503..3e2eed8 100644 --- a/documentation/automatic-updates.md +++ b/documentation/automatic-updates.md @@ -43,7 +43,13 @@ The database dump is also used by all our automated tests. ## Adding update bot to your project -### Artifact action +### 1. Add required secrets + +You must define a repository secret called `AUTOMATIC_UPDATE_TOKEN`. + +Go to your repository's Settings -> Secrets and variables -> Actions and add a secret called `AUTOMATIC_UPDATE_TOKEN`. The value can be found from [Confluence](https://helsinkisolutionoffice.atlassian.net/wiki/spaces/HEL/pages/8354005224/Tunnusten+salasanojen+ja+muiden+avainten+jakaminen) under `AUTOMATIC_UPDATE_TOKEN` section. + +### 2. Enable Artifact action Enable the `artifact` action by adding [.github/workflows/artifact.yml](/.github/workflows/artifact.yml.dist) file to your repository. *NOTE*: `.github/workflows/artifact.yml.dist` might already exist, if it does then you can just rename it to `artifact.yml`. @@ -57,7 +63,7 @@ This will generate an SQL-dump based on your site's current configuration and sa The action will be run automatically once a week after you first run it. -### Update config action +### 3. Enable Update config action Enable the `update-config` action by adding [.github/workflows/update-config.yml](/.github/workflows/update-config.yml.dist) file to your repository. *NOTE*: `.github/workflows/update-config.yml.dist` might already exist, if it does then you can just rename it to `update-config.yml`. From d3644327c7c911668395f5a336648d6beb9e022c Mon Sep 17 00:00:00 2001 From: tuutti Date: Thu, 10 Oct 2024 08:03:10 +0300 Subject: [PATCH 3/3] UHF-10248: Documentation fixes --- documentation/automatic-updates.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/automatic-updates.md b/documentation/automatic-updates.md index 3e2eed8..af752bc 100644 --- a/documentation/automatic-updates.md +++ b/documentation/automatic-updates.md @@ -45,9 +45,9 @@ The database dump is also used by all our automated tests. ### 1. Add required secrets -You must define a repository secret called `AUTOMATIC_UPDATE_TOKEN`. +Go to your repository's Settings -> Secrets and variables -> Actions. -Go to your repository's Settings -> Secrets and variables -> Actions and add a secret called `AUTOMATIC_UPDATE_TOKEN`. The value can be found from [Confluence](https://helsinkisolutionoffice.atlassian.net/wiki/spaces/HEL/pages/8354005224/Tunnusten+salasanojen+ja+muiden+avainten+jakaminen) under `AUTOMATIC_UPDATE_TOKEN` section. +Add a secret called `AUTOMATIC_UPDATE_TOKEN`. The value can be found from [Confluence](https://helsinkisolutionoffice.atlassian.net/wiki/spaces/HEL/pages/8354005224/Tunnusten+salasanojen+ja+muiden+avainten+jakaminen) under `AUTOMATIC_UPDATE_TOKEN` section. ### 2. Enable Artifact action