Skip to content

Commit

Permalink
Merge pull request #270 from City-of-Helsinki/UHF-10248
Browse files Browse the repository at this point in the history
UHF-10248: Use scoped token to trigger create pull request action
  • Loading branch information
tuutti authored Oct 10, 2024
2 parents 572675f + d364432 commit ccdb4f1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/update-config.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -77,6 +83,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: |
Expand Down
10 changes: 8 additions & 2 deletions documentation/automatic-updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Go to your repository's Settings -> Secrets and variables -> Actions.

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`.

Expand All @@ -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`.

Expand Down

0 comments on commit ccdb4f1

Please sign in to comment.