Run wiki bot #77
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run wiki bot | |
on: | |
schedule: | |
- cron: '0 12 * * 5' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
wiki-bot: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Setup npm | |
run: npm install -g npm@10 | |
- name: Cache Node.js modules | |
uses: actions/cache@v3 | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.OS }}-node- | |
- name: Install dependencies | |
run: npm ci | |
- name: Run wiki-bot | |
working-directory: ${{github.workspace}}/tools/wiki-bot | |
run: npm start -- --update | |
- name: Detect changes in data and assets folder | |
id: changes | |
run: echo "changed=$(git diff --quiet --stat HEAD -- ./src/data ./src/assets || echo 'true')" >> $GITHUB_OUTPUT | |
- name: Create Pull Request | |
# Create PR only if there are changes in the src/data or src/assets folder otherwise skip | |
if: steps.changes.outputs.changed == 'true' | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.WIKI_BOT_TOKEN }} | |
title: Wiki bot update | |
body: Updates data extracted from [wiki.dominionstrategy.com](https://wiki.dominionstrategy.com/) | |
add-paths: | | |
src/data/**/* | |
src/assets/**/* | |
tools/wiki-bot/last-generation.json | |
commit-message: 'chore: update data/assets build with WikiBot' | |
branch: wiki-bot-update | |
branch-suffix: timestamp | |
delete-branch: true | |
labels: | | |
wiki bot | |
enhancement | |
assignees: GagaMen,TobiDimmel |