@plainconceptsplatform/workflows 1.21.3 → 1.21.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1946,6 +1946,11 @@ fi
|
|
|
1946
1946
|
if worker_installed implement && ! grep -qF 'cannot run as a subagent' "$IMPLEMENT_WORKER_MD"; then
|
|
1947
1947
|
LEAD_OK=0; echo "FAIL: the implement prompt must stop at a planner-sub spawn error instead of retrying other agents" >&2
|
|
1948
1948
|
fi
|
|
1949
|
+
# gh-aw strips HTML comments from safe-output comments, so the refine marker never reaches GitHub: the
|
|
1950
|
+
# router's auto-accept found no questions anywhere until it matched refine's visible prefix as well.
|
|
1951
|
+
if ! grep -qF 'contains($prefix)' "$ROUTER_YML" || ! grep -qF 'REFINE_PREFIX: "Refinement update"' "$ROUTER_YML"; then
|
|
1952
|
+
LEAD_OK=0; echo "FAIL: the refine auto-accept must find the questions by refine's visible prefix, not only the stripped marker" >&2
|
|
1953
|
+
fi
|
|
1949
1954
|
if [ "$LEAD_OK" -eq 1 ]; then PASS=$((PASS + 1)); else FAIL=$((FAIL + 1)); fi
|
|
1950
1955
|
# The harness plugins only load with .opencode/node_modules installed; without it every CI run
|
|
1951
1956
|
# spawned untiered workers on the session's model. And the tier model a worker pins has to be one
|
|
@@ -3739,6 +3744,10 @@ rc 'test-timings\.mjs' "$CI_DOTNET" 'the .NET template must summarise the test t
|
|
|
3739
3744
|
SYNC_YML="${HERE}/../../templates/platform-template/.github/workflows/platform-template-sync.yml"
|
|
3740
3745
|
rc '^ UV_SHA256: [0-9a-f]{64}$' "$SYNC_YML" 'the template sync must pin uv by SHA-256'
|
|
3741
3746
|
rc 'sha256sum --check --strict' "$SYNC_YML" 'the template sync must check the uv download'
|
|
3747
|
+
# A conformance run that could not read the template must not pass as a comparison.
|
|
3748
|
+
rc 'compare\+=\(--require-source\)' "$CI_DOTNET" 'the conformance job must require the template when it has a token'
|
|
3749
|
+
rc 'create-github-app-token@[0-9a-f]{40}' "$CI_DOTNET" 'the conformance job must mint a token that reads the template'
|
|
3750
|
+
rc "requireSource \\? \\{ failures: \\[message\\]" "${HERE}/../../templates/platform-template/scripts/check-platform-conformance.mjs" 'check-platform-conformance must fail on an unread template with --require-source'
|
|
3742
3751
|
rc "python3 -c 'import ensurepip'" "$SYNC_YML" 'the template sync must not try a venv where ensurepip is missing'
|
|
3743
3752
|
if [ "$RC_OK" -eq 1 ]; then PASS=$((PASS + 1)); else FAIL=$((FAIL + 1)); fi
|
|
3744
3753
|
|
|
@@ -33,6 +33,12 @@ on:
|
|
|
33
33
|
secrets:
|
|
34
34
|
NPM_REGISTRY_TOKEN:
|
|
35
35
|
required: false
|
|
36
|
+
# The bot App, for the platform conformance job to read the template repository when it is
|
|
37
|
+
# private. A deploy pipeline passes them; without them the owned files are not compared.
|
|
38
|
+
BOT_APP_ID:
|
|
39
|
+
required: false
|
|
40
|
+
BOT_PRIVATE_KEY:
|
|
41
|
+
required: false
|
|
36
42
|
|
|
37
43
|
permissions:
|
|
38
44
|
contents: read
|
|
@@ -518,17 +524,34 @@ jobs:
|
|
|
518
524
|
name: Platform conformance
|
|
519
525
|
runs-on: ${{ vars.CI_RUNNER || 'agents-arc' }}
|
|
520
526
|
timeout-minutes: 5
|
|
527
|
+
env:
|
|
528
|
+
HAS_BOT_APP: ${{ secrets.BOT_APP_ID != '' && secrets.BOT_PRIVATE_KEY != '' }}
|
|
521
529
|
steps:
|
|
522
530
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
523
531
|
with:
|
|
524
532
|
fetch-depth: 0
|
|
533
|
+
# The template repository is usually private, and GITHUB_TOKEN reads only this one. Without a
|
|
534
|
+
# token the comparison could not run and the job still said the owned files matched.
|
|
535
|
+
- name: Token that reads the platform template
|
|
536
|
+
id: app-token
|
|
537
|
+
if: env.HAS_BOT_APP == 'true'
|
|
538
|
+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
|
539
|
+
with:
|
|
540
|
+
app-id: ${{ secrets.BOT_APP_ID }}
|
|
541
|
+
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
|
|
542
|
+
owner: ${{ github.repository_owner }}
|
|
525
543
|
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
526
544
|
with:
|
|
527
545
|
node-version: ${{ env.NODE_VERSION }}
|
|
546
|
+
# The token reaches git through process-scoped config only, never a file on the runner.
|
|
528
547
|
- name: Owned files change only through a template sync
|
|
529
548
|
env:
|
|
530
549
|
EVENT: ${{ github.event_name }}
|
|
531
550
|
BASE_REF: ${{ github.base_ref }}
|
|
551
|
+
GIT_CONFIG_COUNT: ${{ steps.app-token.outputs.token != '' && '1' || '0' }}
|
|
552
|
+
GIT_CONFIG_KEY_0: url.https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/.insteadOf
|
|
553
|
+
GIT_CONFIG_VALUE_0: https://github.com/
|
|
554
|
+
HAS_TOKEN: ${{ steps.app-token.outputs.token != '' }}
|
|
532
555
|
run: |
|
|
533
556
|
set -euo pipefail
|
|
534
557
|
if [ ! -f .platform/contract.yml ] && { [ ! -f .copier-answers.yml ] || [ ! -f .platform/manifest ]; }; then
|
|
@@ -539,11 +562,19 @@ jobs:
|
|
|
539
562
|
echo "::error::This repository has a platform contract but no scripts/check-platform-conformance.mjs. Install it with: npx @plainconceptsplatform/workflows add --template platform-template"
|
|
540
563
|
exit 1
|
|
541
564
|
fi
|
|
565
|
+
# With a token the template must be read; without one (Dependabot, a caller that passes no
|
|
566
|
+
# secrets) the job still checks for changes outside a sync, and says it did not compare.
|
|
567
|
+
compare=(--compare)
|
|
568
|
+
if [ "$HAS_TOKEN" = true ]; then
|
|
569
|
+
compare+=(--require-source)
|
|
570
|
+
else
|
|
571
|
+
echo "::warning::No bot App token in this run, so the owned files were not compared with the template. Pass BOT_APP_ID and BOT_PRIVATE_KEY to this workflow."
|
|
572
|
+
fi
|
|
542
573
|
if [ "$EVENT" = pull_request ]; then
|
|
543
574
|
git fetch origin "$BASE_REF"
|
|
544
|
-
node scripts/check-platform-conformance.mjs
|
|
575
|
+
node scripts/check-platform-conformance.mjs "${compare[@]}" --base "origin/$BASE_REF" | tee -a "$GITHUB_STEP_SUMMARY"
|
|
545
576
|
else
|
|
546
|
-
node scripts/check-platform-conformance.mjs
|
|
577
|
+
node scripts/check-platform-conformance.mjs "${compare[@]}" | tee -a "$GITHUB_STEP_SUMMARY"
|
|
547
578
|
fi
|
|
548
579
|
|
|
549
580
|
secret-scan:
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
// Keeps the paths a platform contract (.platform/contract.yml) marks as `owned` equal to the template
|
|
4
4
|
// they come from. A pull request may change them only in a template sync (it changes `sync.marker` or
|
|
5
5
|
// moves `sync.version`) or under an unexpired exception; conflict markers and expired exceptions fail.
|
|
6
|
-
// With --compare, owned files are also compared with `source.url` at the recorded version
|
|
6
|
+
// With --compare, owned files are also compared with `source.url` at the recorded version; with
|
|
7
|
+
// --require-source as well, a template it cannot read is a failure rather than a note.
|
|
7
8
|
// Without a contract it passes silently. .copier-answers.yml + .platform/manifest is read as one.
|
|
8
9
|
//
|
|
9
|
-
// Usage: node scripts/check-platform-conformance.mjs [--base <git ref>] [--compare]
|
|
10
|
+
// Usage: node scripts/check-platform-conformance.mjs [--base <git ref>] [--compare [--require-source]]
|
|
10
11
|
// node scripts/check-platform-conformance.mjs --contract (key=value lines for $GITHUB_OUTPUT)
|
|
11
12
|
|
|
12
13
|
import { execFileSync } from 'node:child_process';
|
|
@@ -321,7 +322,7 @@ function sourceBlobs(url, version) {
|
|
|
321
322
|
}
|
|
322
323
|
}
|
|
323
324
|
|
|
324
|
-
function compareWithSource(root, contract, patterns, live, version) {
|
|
325
|
+
function compareWithSource(root, contract, patterns, live, version, requireSource = false) {
|
|
325
326
|
const failures = [];
|
|
326
327
|
const notes = [];
|
|
327
328
|
const { name, url, changes } = contract.source;
|
|
@@ -331,7 +332,8 @@ function compareWithSource(root, contract, patterns, live, version) {
|
|
|
331
332
|
source = sourceBlobs(url, version);
|
|
332
333
|
} catch (error) {
|
|
333
334
|
const reason = String(error.stderr ?? error.message).trim().split('\n').at(-1);
|
|
334
|
-
|
|
335
|
+
const message = `cannot read ${url} at ${version} (${reason}); owned files were not compared with the source`;
|
|
336
|
+
return requireSource ? { failures: [message], notes, compared: false } : { failures, notes: [message], compared: false };
|
|
335
337
|
}
|
|
336
338
|
const local = blobIds(git(root, ['ls-files', '-s', '-z']), 1);
|
|
337
339
|
for (const [path, id] of source) {
|
|
@@ -343,10 +345,10 @@ function compareWithSource(root, contract, patterns, live, version) {
|
|
|
343
345
|
}
|
|
344
346
|
const onlyHere = [...local.keys()].filter((path) => isOwned(patterns, path) && !source.has(path));
|
|
345
347
|
if (onlyHere.length > 0) notes.push(`${onlyHere.length} owned file(s) are not in ${name} at ${version} under the same path; not compared`);
|
|
346
|
-
return { failures, notes };
|
|
348
|
+
return { failures, notes, compared: true };
|
|
347
349
|
}
|
|
348
350
|
|
|
349
|
-
export function checkConformance(root, { base, compare = false, today = new Date().toISOString().slice(0, 10) } = {}) {
|
|
351
|
+
export function checkConformance(root, { base, compare = false, requireSource = false, today = new Date().toISOString().slice(0, 10) } = {}) {
|
|
350
352
|
const read = (path) => (existsSync(join(root, path)) ? readFileSync(join(root, path), 'utf8') : undefined);
|
|
351
353
|
let contract;
|
|
352
354
|
try {
|
|
@@ -395,12 +397,14 @@ export function checkConformance(root, { base, compare = false, today = new Date
|
|
|
395
397
|
}
|
|
396
398
|
}
|
|
397
399
|
}
|
|
400
|
+
let compared;
|
|
398
401
|
if (compare) {
|
|
399
|
-
const result = compareWithSource(root, contract, patterns, live, version);
|
|
402
|
+
const result = compareWithSource(root, contract, patterns, live, version, requireSource);
|
|
400
403
|
failures.push(...result.failures);
|
|
401
404
|
notes.push(...result.notes);
|
|
405
|
+
compared = result.compared;
|
|
402
406
|
}
|
|
403
|
-
return { adopted: true, failures, notes };
|
|
407
|
+
return { adopted: true, failures, notes, compared };
|
|
404
408
|
}
|
|
405
409
|
|
|
406
410
|
// One key=value line per field, for $GITHUB_OUTPUT; contract=absent when there is none.
|
|
@@ -428,9 +432,9 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)
|
|
|
428
432
|
const args = process.argv.slice(2);
|
|
429
433
|
const baseIndex = args.indexOf('--base');
|
|
430
434
|
const base = baseIndex === -1 ? undefined : args[baseIndex + 1];
|
|
431
|
-
const unknown = args.filter((arg, i) => i !== baseIndex + 1 || baseIndex === -1).filter((arg) => !['--base', '--compare', '--contract'].includes(arg));
|
|
435
|
+
const unknown = args.filter((arg, i) => i !== baseIndex + 1 || baseIndex === -1).filter((arg) => !['--base', '--compare', '--require-source', '--contract'].includes(arg));
|
|
432
436
|
if ((baseIndex !== -1 && !base) || unknown.length > 0) {
|
|
433
|
-
console.error('usage: node scripts/check-platform-conformance.mjs [--base <git ref>] [--compare] | --contract');
|
|
437
|
+
console.error('usage: node scripts/check-platform-conformance.mjs [--base <git ref>] [--compare [--require-source]] | --contract');
|
|
434
438
|
process.exit(2);
|
|
435
439
|
}
|
|
436
440
|
const root = fileURLToPath(new URL('..', import.meta.url));
|
|
@@ -444,10 +448,11 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)
|
|
|
444
448
|
process.exit(1);
|
|
445
449
|
}
|
|
446
450
|
}
|
|
447
|
-
const { adopted, failures, notes } = checkConformance(root, { base, compare: args.includes('--compare') });
|
|
451
|
+
const { adopted, failures, notes, compared } = checkConformance(root, { base, compare: args.includes('--compare'), requireSource: args.includes('--require-source') });
|
|
448
452
|
if (!adopted) process.exit(0);
|
|
449
453
|
for (const note of notes) console.log(`· ${note}`);
|
|
450
454
|
for (const failure of failures) console.error(`✗ ${failure}`);
|
|
451
|
-
|
|
455
|
+
// Only a comparison that ran may say the files match: an unread template proves nothing.
|
|
456
|
+
if (failures.length === 0) console.log(compared === false ? '✓ no owned file changed outside a template sync (not compared with the template)' : '✓ owned files match the template');
|
|
452
457
|
process.exit(failures.length === 0 ? 0 : 1);
|
|
453
458
|
}
|
|
@@ -1718,6 +1718,10 @@ jobs:
|
|
|
1718
1718
|
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
|
1719
1719
|
REPO: ${{ github.repository }}
|
|
1720
1720
|
REFINE_MARKER: "<!-- agent-refine -->"
|
|
1721
|
+
# gh-aw strips HTML comments from safe-output comments, so the marker above never reaches
|
|
1722
|
+
# GitHub and this step found no questions in any repository. The visible prefix refine
|
|
1723
|
+
# puts first (agent-refine's SAFE_OUTPUT_COMMENT_PREFIX) identifies them instead.
|
|
1724
|
+
REFINE_PREFIX: "Refinement update"
|
|
1721
1725
|
QUESTIONS_LINE: "I have some questions about this issue"
|
|
1722
1726
|
PROPOSED_TAG: "**Proposed:**"
|
|
1723
1727
|
DECISION_TAG: "**Your decision needed:**"
|
|
@@ -1744,8 +1748,10 @@ jobs:
|
|
|
1744
1748
|
while IFS=$'\t' read -r issue people; do
|
|
1745
1749
|
[ -n "$issue" ] || continue
|
|
1746
1750
|
comments=$(gh api --paginate "repos/$REPO/issues/$issue/comments?per_page=100" | jq -s 'add // []')
|
|
1747
|
-
asked=$(jq -c --arg marker "$REFINE_MARKER" --arg line "$QUESTIONS_LINE" '
|
|
1748
|
-
[.[] | select(.user.type == "Bot"
|
|
1751
|
+
asked=$(jq -c --arg marker "$REFINE_MARKER" --arg prefix "$REFINE_PREFIX" --arg line "$QUESTIONS_LINE" '
|
|
1752
|
+
[.[] | select(.user.type == "Bot"
|
|
1753
|
+
and ((.body | contains($marker)) or (.body | contains($prefix)))
|
|
1754
|
+
and (.body | contains($line)))]
|
|
1749
1755
|
| last // empty | {id, created_at, body}' <<<"$comments")
|
|
1750
1756
|
[ -n "$asked" ] || continue
|
|
1751
1757
|
asked_at=$(jq -r '.created_at' <<<"$asked")
|