Agentic llmdoc Updater #93
This file contains hidden or 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: Agentic llmdoc Updater | |
| on: | |
| schedule: | |
| # 每天北京时间 5:00 (UTC 21:00) 自动更新 llmdoc 文档 | |
| - cron: '0 21 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| since_period: | |
| description: '检查变更的时间范围(默认24小时)' | |
| required: false | |
| type: string | |
| default: '24 hours ago' | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| id-token: write | |
| jobs: | |
| prepare-llmdoc: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| since_period: ${{ steps.check.outputs.since_period }} | |
| steps: | |
| - name: Close stale llmdoc PRs and extend time range | |
| id: check | |
| env: | |
| GH_TOKEN: ${{ secrets.PAT_TOKEN || github.token }} | |
| GH_REPO: ${{ github.repository }} | |
| run: | | |
| EXISTING=$(gh pr list --state open --json number,headRefName,createdAt \ | |
| --jq '[.[] | select(.headRefName | startswith("docs/llmdoc-update-"))]') | |
| COUNT=$(echo "$EXISTING" | jq 'length') | |
| DEFAULT="${{ github.event.inputs.since_period || '24 hours ago' }}" | |
| if [ "$COUNT" -gt 0 ]; then | |
| OLDEST=$(echo "$EXISTING" | jq -r 'sort_by(.createdAt) | .[0].createdAt') | |
| echo "Closing $COUNT stale llmdoc PR(s), extending range to $OLDEST" | |
| echo "$EXISTING" | jq -r '.[].number' | while read num; do | |
| gh pr close "$num" --delete-branch 2>/dev/null || true | |
| done | |
| echo "since_period=$OLDEST" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "since_period=$DEFAULT" >> "$GITHUB_OUTPUT" | |
| fi | |
| update-llmdoc: | |
| needs: prepare-llmdoc | |
| uses: Lightspeed-Intelligence/agentic-workflow-template/.github/workflows/update-llmdoc.yml@main | |
| secrets: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| ANTHROPIC_BASE_URL: ${{ secrets.ANTHROPIC_BASE_URL }} | |
| PAT_TOKEN: ${{ secrets.PAT_TOKEN }} | |
| FEISHU_WEBHOOK_TOKEN: ${{ secrets.FEISHU_LLMDOC_WEBHOOK_TOKEN }} | |
| with: | |
| use_feishu_notify: true | |
| since_period: ${{ needs.prepare-llmdoc.outputs.since_period }} | |
| target_branch: master | |
| # Same toolchain as the reviewer. Doc updates routinely assert things | |
| # about code ("guarded by X", "section N pins Y"), and this repo has been | |
| # burned by assertions that were merely plausible; being able to actually | |
| # run the checks is what makes verifying them possible instead of | |
| # guessing. Everything this installs is gitignored, which this link | |
| # requires: the updater packages the worktree into a candidate commit. | |
| setup_script: .github/agentic/setup.sh |