-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (76 loc) · 2.85 KB
/
verify.yml
File metadata and controls
85 lines (76 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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