Skip to content

Commit 71b3543

Browse files
committed
ci: support mode=tier0 (auto report) vs all (/verify) in verify handler
Auto PR reports relayed from TechAPI run Tier 0 only (fast, no network) under the techengine-verify-report marker; /verify runs all tiers under techengine-verify-command. Both posted as TechEngineBot.
1 parent 48f3bce commit 71b3543

1 file changed

Lines changed: 33 additions & 14 deletions

File tree

.github/workflows/techapi-verify-comment.yml

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ permissions:
2020
contents: read
2121

2222
concurrency:
23-
group: techapi-verify-${{ github.event.client_payload.pr_number || inputs.pr_number }}
23+
group: techapi-verify-${{ github.event.client_payload.pr_number || inputs.pr_number }}-${{ github.event.client_payload.mode || 'all' }}
2424
cancel-in-progress: true
2525

2626
jobs:
@@ -33,6 +33,9 @@ jobs:
3333
TECHAPI_HEAD_SHA: ${{ github.event.client_payload.head_sha || inputs.head_sha }}
3434
REQUESTED_BY: ${{ github.event.client_payload.requested_by || github.actor }}
3535
TECHAPI_COMMENT_ID: ${{ github.event.client_payload.comment_id }}
36+
# "tier0" = auto PR report (relayed by TechAPI verify-report.yml); else the
37+
# on-demand /verify all-tiers run.
38+
MODE: ${{ github.event.client_payload.mode || 'all' }}
3639
steps:
3740
# Acknowledge the /verify command as TechEngineBot (the bot holds the token;
3841
# the relay side must not react, or it looks like the requester self-reacting).
@@ -66,17 +69,26 @@ jobs:
6669
python-version: "3.12"
6770

6871
# app.verify is a stdlib-only TechAPI module; run it from the checkout.
69-
# `pr` runs all tiers (0 offline score, 1 source-URL liveness, 2 external
70-
# cross-reference, 3 promotion DRY-RUN) over the PR's changed records, plus
71-
# a full-dataset Tier 0 baseline. Network tiers are capped and never write.
72-
- name: Run all-tiers verification
72+
# mode=tier0 (auto PR report): fast offline Tier 0 only (changed + baseline).
73+
# mode=all (/verify on demand): `pr` runs Tiers 0-3 (3 = promotion DRY-RUN).
74+
- name: Run verification
7375
id: verify
7476
run: |
7577
cd TechAPI
7678
git fetch origin main --depth=1 || true
7779
{
7880
echo 'report<<VERIFY_EOF'
79-
python -m app.verify pr || echo "_app.verify unavailable on this ref._"
81+
if [ "${MODE}" = "tier0" ]; then
82+
echo "### Changed records in this PR"
83+
echo ""
84+
python -m app.verify score --changed --no-cache --format md || echo "_app.verify unavailable on this ref._"
85+
echo ""
86+
echo "### Full-dataset baseline"
87+
echo ""
88+
python -m app.verify score --no-cache --format md || true
89+
else
90+
python -m app.verify pr || echo "_app.verify unavailable on this ref._"
91+
fi
8092
echo VERIFY_EOF
8193
} >> "$GITHUB_OUTPUT"
8294
@@ -87,19 +99,26 @@ jobs:
8799
REPORT: ${{ steps.verify.outputs.report }}
88100
PR_NUMBER: ${{ env.TECHAPI_PR_NUMBER }}
89101
REQUESTED_BY: ${{ env.REQUESTED_BY }}
102+
MODE: ${{ env.MODE }}
90103
with:
91104
github-token: ${{ secrets.TECHENGINEBOT_TOKEN || secrets.TECHAPI_TOKEN }}
92105
script: |
93-
const marker = '<!-- techengine-verify-command -->';
94106
const report = (process.env.REPORT || '').trim() || '(no output)';
95107
const by = process.env.REQUESTED_BY || 'someone';
96-
// `pr` already emits its own H2 heading + tier sections; just frame it.
97-
const body = [
98-
marker,
99-
report,
100-
'',
101-
`<sub>Requested by @${by} via \`/verify\` · scored by \`app.verify\`, posted by **TechEngineBot**. Informational only — the structural gate (\`app.validate\`) is separate; Tier 3 here is dry-run.</sub>`,
102-
].join('\n');
108+
const isTier0 = (process.env.MODE || 'all') === 'tier0';
109+
// Auto report and on-demand /verify use distinct marked comments.
110+
const marker = isTier0
111+
? '<!-- techengine-verify-report -->'
112+
: '<!-- techengine-verify-command -->';
113+
const head = isTier0
114+
? ['## 🔎 Data verification — Tier 0 (offline existence/trust)', '',
115+
'Scored by `app.verify`; posted by **TechEngineBot**. Informational only — the structural gate (`app.validate`) is separate and authoritative for merge.', '',
116+
report]
117+
: [report]; // `pr` emits its own H2 heading + tier sections
118+
const footer = isTier0
119+
? '<sub>green = authoritative source + complete + consistent · yellow = plausible, needs confirmation · red = sparse/weak source or a hard contradiction. Promotion to `verified` runs in the scheduled `verify-network` workflow.</sub>'
120+
: `<sub>Requested by @${by} via \`/verify\` · scored by \`app.verify\`, posted by **TechEngineBot**. Informational only — the structural gate (\`app.validate\`) is separate; Tier 3 here is dry-run.</sub>`;
121+
const body = [marker, ...head, '', footer].join('\n');
103122
const owner = 'GetTechAPI';
104123
const repo = 'TechAPI';
105124
const issue_number = Number(process.env.PR_NUMBER);

0 commit comments

Comments
 (0)