Skip to content

Sync Documentation from BetterGov #368

Sync Documentation from BetterGov

Sync Documentation from BetterGov #368

Workflow file for this run

name: Sync Documentation from BetterGov
on:
schedule:
# Run every 12 hours to check for updates
- cron: '0 */12 * * *'
workflow_dispatch:
# Allow manual triggering
repository_dispatch:
types: [sync-docs]
pull_request:
# Run on pull requests
push:
branches:
- main
jobs:
sync-docs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: package-lock.json
- name: Install dependencies
run: npm ci
- name: Sync documentation from BetterGov
run: node scripts/sync-docs.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check for changes
id: verify-changed-files
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Commit and push changes
if: steps.verify-changed-files.outputs.changed == 'true' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch')
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "docs: sync documentation from BetterGov repository [skip ci]"
git push