Skip to content

Sync wiki issue state #44

Sync wiki issue state

Sync wiki issue state #44

name: Sync wiki issue state
on:
schedule:
- cron: "30 11 * * *" # Daily at 11:30 UTC
workflow_dispatch: {}
permissions:
contents: read
pull-requests: read
issues: read
concurrency:
group: wiki-issue-sync
cancel-in-progress: false
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
GRAPHIFY_SKIP_HOOK: "1"
jobs:
sync:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.PR_BOT_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "24.14.0"
- name: Enable pnpm via Corepack
run: corepack enable && corepack prepare pnpm@10.33.0 --activate
- name: Get pnpm store path
id: pnpm-cache
run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
- name: Cache pnpm store
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Require bot token
run: |
test -n "$GH_TOKEN" || { echo 'PR_BOT_TOKEN is required'; exit 1; }
gh auth setup-git
- name: Refresh issue state
id: refresh
run: |
base="$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')"
git checkout -B bot/wiki-issue-sync "origin/${base}"
node scripts/wiki/refresh-issue-state.cjs
pnpm run graph:build
pnpm run wiki:check
git add wiki scripts/graph/data/graph.json
if git diff --cached --quiet; then
echo "changed=false" >> "$GITHUB_OUTPUT"
echo "No issue-state changes."
else
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -m "docs(wiki): refresh cited issue state"
git push --force-with-lease origin bot/wiki-issue-sync
echo "base_branch=${base}" >> "$GITHUB_OUTPUT"
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Open or update PR
if: steps.refresh.outputs.changed == 'true'
env:
PR_BASE_BRANCH: ${{ steps.refresh.outputs.base_branch }}
PR_HEAD_BRANCH: bot/wiki-issue-sync
PR_DRAFT: "false"
PR_AI: ${{ vars.PR_AI }}
PR_AI_ENDPOINT: ${{ vars.PR_AI_ENDPOINT }}
PR_AI_MODEL: ${{ vars.PR_AI_MODEL }}
PR_AI_API_KEY: ${{ secrets.PR_AI_API_KEY }}
run: pnpm run pr:create