Skip to content

Update InclusionBot.md #25

Update InclusionBot.md

Update InclusionBot.md #25

name: inclusion bot updates
on:
pull_request:
paths:
- InclusionBot.md
jobs:
synchronize:
name: Synchronize Inclusion Bot word lists
runs-on: ubuntu-latest
steps:
# Rather than use a personal access token to interact with the project, we
# can use this GitHub App. There's an API for exchanging app credentials
# for a short-term token, and we use that API here.
- name: get token
uses: tibdex/github-app-token@v1
id: app_token
with:
app_id: ${{ secrets.APP_ID }}
installation_id: ${{ secrets.APP_INSTALLATION_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
# Use the branch commit instead of the PR merge commit
ref: ${{ github.event.pull_request.head.ref }}
# Use app credentials for the token, so that any commits generated by
# this job will trigger a rebuild, so the thing can be merged
token: ${{ steps.app_token.outputs.token }}
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
- run: npx -y prettier -w InclusionBot.md
- run: node sync-inclusion-bot-words.js
- if: failure()
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🚨 The Inclusion Bot word lists could not be synchronized. Please check the syntax of the markdown file.'
});
# Check if anything has changed. This will exit with 0 if there is nothing
# in the diff, or non-zero if anything has changed.
- run: if git diff --exit-code --quiet; then echo "::set-output name=changes::no"; else echo "::set-output name=changes::yes"; fi
id: diff
# If anything changed, commit it.
- if: steps.diff.outputs.changes == 'yes'
uses: EndBug/add-and-commit@v9
with:
message: synchronize word lists
- if: steps.diff.outputs.changes == 'yes'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `The Inclusion Bot word lists have been synchronized. @${context.actor}, please pull the last commit before pushing any more changes to this branch.`
});