@@ -3,13 +3,13 @@ name: Apply validated fix
33on :
44 push :
55 branches : ['agent/phase2-validated-output']
6+ pull_request :
67
78permissions :
89 contents : write
910
1011jobs :
1112 apply-fix :
12- if : github.event.head_commit.message == 'ci: apply validated regression fix'
1313 runs-on : ubuntu-latest
1414 steps :
1515 - uses : actions/checkout@v4
2121 - name : Apply audited regression patch
2222 shell : bash
2323 run : |
24+ if [ "$(git log -1 --pretty=%s)" != "ci: run validated regression fix in PR" ]; then
25+ echo "Patch job is not needed for this commit."
26+ exit 0
27+ fi
2428 python3 <<'PY'
2529 from pathlib import Path
2630
@@ -49,11 +53,11 @@ jobs:
4953
5054 test = Path('global-template/docgen/test/semantic-index.test.mjs')
5155 text = test.read_text()
52- text = text.replace(
53- "test('audit rejects unknown model references and publish rejects stale source artifacts', async () => {",
54- "test('audit sanitizes unknown model references and publish rejects stale source artifacts', async () => {",
55- 1,
56- )
56+ old_name = "test('audit rejects unknown model references and publish rejects stale source artifacts', async () => {"
57+ new_name = "test('audit sanitizes unknown model references and publish rejects stale source artifacts', async () => {"
58+ if text.count(old_name) != 1:
59+ raise SystemExit(f'test-name replacement count was {text.count(old_name)}, expected 1')
60+ text = text.replace(old_name, new_name )
5761 old = """ await assert.rejects(() => audit(root), /Quality failed/); const report = readJson(path.join(p.audit, 'deterministic.json')); assert(report.errors.some((error) => /unknown sourceModelRef/.test(error)));
5862 trace.claims[0].sourceModelRefs = ['system:resource']; writeJson(traceFile, trace); await audit(root);
5963 """
7579 working-directory : global-template/docgen
7680 run : npm run check && npm test
7781 - name : Commit validated patch
82+ shell : bash
7883 run : |
84+ if [ "$(git log -1 --pretty=%s)" != "ci: run validated regression fix in PR" ]; then
85+ exit 0
86+ fi
7987 git config user.name 'docgen-ci'
8088 git config user.email 'actions@users.noreply.github.com'
8189 git add global-template/docgen/lib/audit-guard.mjs global-template/docgen/test/semantic-index.test.mjs
0 commit comments