Verify #5
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: Verify | |
| on: | |
| schedule: | |
| - cron: '0 9 * * 1' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| verify: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Run verifier | |
| id: verify | |
| run: | | |
| set +e | |
| node scripts/verify.js | tee verify-output.txt | |
| echo "exit_code=$?" >> "$GITHUB_OUTPUT" | |
| set -e | |
| - name: Ensure 'knowledge-drift' label exists | |
| if: steps.verify.outputs.exit_code != '0' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh label create knowledge-drift \ | |
| --description "Automated verification detected stale or missing entities" \ | |
| --color F5C518 \ | |
| --force | |
| - name: Open or update drift issue | |
| if: steps.verify.outputs.exit_code != '0' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -e | |
| TITLE="Knowledge drift detected — $(date +%Y-%m-%d)" | |
| # Build the body from the verifier output. | |
| { | |
| echo "Automated weekly verification flagged one or more stale or missing entities." | |
| echo "" | |
| echo "## Report" | |
| echo "" | |
| echo '```' | |
| cat verify-output.txt | |
| echo '```' | |
| echo "" | |
| echo "### What to do" | |
| echo "" | |
| echo "1. Review the entities listed above." | |
| echo "2. For each, either:" | |
| echo " - Re-verify the underlying source and bump the \`last_verified\` date in its frontmatter, **or**" | |
| echo " - Update the entity with corrected information." | |
| echo "3. Run \`node scripts/verify.js\` locally to confirm the issue clears." | |
| echo "4. Commit and push. This issue can be closed once verification passes." | |
| echo "" | |
| echo "---" | |
| echo "_This issue was opened automatically by [.github/workflows/verify.yml](../blob/main/.github/workflows/verify.yml)._" | |
| } > issue-body.md | |
| # Reuse an open issue with the 'knowledge-drift' label if one exists, | |
| # otherwise create a new one. This prevents a new issue every Monday | |
| # when drift persists across runs. | |
| EXISTING=$(gh issue list --label knowledge-drift --state open --json number --jq '.[0].number // empty') | |
| if [ -n "$EXISTING" ]; then | |
| echo "Updating existing drift issue #$EXISTING" | |
| gh issue comment "$EXISTING" --body-file issue-body.md | |
| gh issue edit "$EXISTING" --title "$TITLE" | |
| else | |
| echo "Opening new drift issue" | |
| gh issue create \ | |
| --title "$TITLE" \ | |
| --body-file issue-body.md \ | |
| --label knowledge-drift | |
| fi |