Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/scripts/check-remote-pins.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,23 @@ const supportedSchemas = new Set(["1.0.0", "1.1.0"].map((version) => `https://ag
// Copilot CLI's plugin reference (github/docs@8e7396e); legacy order also tested in d838c30^.
const legacyManifestPaths = [".plugin/plugin.json", "plugin.json", ".github/plugin/plugin.json", ".claude-plugin/plugin.json"];

export function githubApi(endpoint, run = spawnSync) {
const result = run("gh", ["api", endpoint, "--include", "-H", "Accept: application/vnd.github.raw+json"], {
export function githubApi(endpoint, run = spawnSync, method = "GET") {
if (!["GET", "POST"].includes(method)) throw new Error(`Unsupported GitHub API method ${method}.`);
const args = ["api", endpoint, "--include", "-H", `Accept: ${method === "POST" ? "application/vnd.github+json" : "application/vnd.github.raw+json"}`];
if (method === "POST") args.push("-X", method, "-H", "X-GitHub-Api-Version: 2026-03-10");
const result = run("gh", args, {
encoding: "utf8",
stdio: ["ignore", "pipe", "pipe"],
maxBuffer: 16 * 1024 * 1024,
});
if (result.error) throw new Error(`Couldn't run gh api (${result.error.code ?? "process error"}).`);
const response = /^HTTP\/[\d.]+\s+(\d{3})[^\r\n]*\r?\n[\s\S]*?\r?\n\r?\n([\s\S]*)$/.exec(result.stdout ?? "");
if (!response) {
throw new Error(`GitHub API request failed for ${endpoint} (exit ${result.status}; no HTTP response).`);
}
const status = Number(response[1]);
if (result.status !== 0 && status === 200) {
throw new Error(`gh api failed for ${endpoint} (exit ${result.status}) despite HTTP 200.`);
if (result.status !== 0 && status >= 200 && status < 300) {
throw new Error(`gh api failed for ${endpoint} (exit ${result.status}) despite HTTP ${status}.`);
}
return { status, body: response[2] };
}
Expand Down
424 changes: 424 additions & 0 deletions .github/scripts/update-pins.mjs

Large diffs are not rendered by default.

630 changes: 630 additions & 0 deletions .github/scripts/update-pins.test.mjs

Large diffs are not rendered by default.

21 changes: 20 additions & 1 deletion .github/scripts/validation.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,9 @@ test("manifest authentication and server errors stop rather than falling through
});

test("gh transport retains HTTP statuses and raw JSON without exposing stderr", () => {
const run = (_command, args) => {
const run = (_command, args, options) => {
assert.ok(args.includes("--include"));
assert.equal(options.maxBuffer, 16 * 1024 * 1024);
return { status: 0, stdout: 'HTTP/2.0 200 OK\r\nContent-Type: application/json\r\n\r\n{"name":"tool"}', stderr: "" };
};
assert.deepEqual(githubApi("repos/owner/repo", run), { status: 200, body: '{"name":"tool"}' });
Expand All @@ -311,6 +312,24 @@ test("gh transport retains HTTP statuses and raw JSON without exposing stderr",
assert.throws(() => githubApi("repos/owner/repo", () => ({ error: { code: "ENOENT" } })), /Couldn't run gh api \(ENOENT\)/);
});

test("gh transport supports Copilot review POSTs and retains conflict status", () => {
const run = (_command, args) => {
assert.ok(args.includes("-X"));
assert.equal(args[args.indexOf("-X") + 1], "POST");
assert.ok(args.includes("X-GitHub-Api-Version: 2026-03-10"));
assert.ok(args.includes("Accept: application/vnd.github+json"));
return { status: 0, stdout: 'HTTP/2.0 201 Created\r\nContent-Type: application/json\r\n\r\n{"state":"PENDING"}', stderr: "" };
};
assert.deepEqual(githubApi("repos/owner/repo/pulls/7/copilot-code-review", run, "POST"), {
status: 201,
body: '{"state":"PENDING"}',
});
assert.deepEqual(githubApi("repos/owner/repo/pulls/7/copilot-code-review", () => ({
status: 1, stdout: "HTTP/2.0 409 Conflict\nContent-Type: application/json\n\n{}", stderr: "",
}), "POST"), { status: 409, body: "{}" });
assert.throws(() => githubApi("repos/owner/repo", spawnSync, "DELETE"), /Unsupported GitHub API method DELETE/);
});

test("schema script keeps pinned AJV and draft2020, and cleans its directory on success and failures", (t) => {
const directory = fixture(t);
mkdirSync(resolve(directory, ".github/scripts"), { recursive: true });
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/evals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: Evals
# This full smoke-suite workflow starts by explicit manual dispatch only.
# Same-repository PRs that change plugins/<plugin>/skills/<skill>/ with a matching
# evals/<plugin>/skills/<skill>/eval.yaml run .github/workflows/skill-eval-comparison.yml
# (using github/evals-action@3c551330898c1467b8ddf9ef7c7f6e6c6af489d6 from
# github/evals-action#34 with report-id: evals-baseline and
# (using github/evals-action with report-id: evals-baseline and
# baseline-report-id: evals-baseline to update one sticky PR comment automatically);
# see docs/checks-and-evals.md#automatic-pr-skill-comparison.
on:
Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/skill-eval-comparison.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ permissions:
jobs:
select:
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.full_name == github.repository
concurrency:
group: skill-eval-comparison-${{ github.event.pull_request.number || github.ref }}-select
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
Expand Down Expand Up @@ -59,6 +62,9 @@ jobs:
run-baseline:
needs: select
if: needs.select.outputs.eval_paths != ''
concurrency:
group: skill-eval-comparison-${{ github.event.pull_request.number || github.ref }}-run-baseline
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
Expand Down Expand Up @@ -86,7 +92,7 @@ jobs:
git checkout "$BASE_SHA" -- "$dir"
fi
done <<< "$SKILL_DIRS"
- uses: github/evals-action@3c551330898c1467b8ddf9ef7c7f6e6c6af489d6
- uses: github/evals-action@d7b40d34236f09c8078a2b4e0008ed2ac81919cb
continue-on-error: true
env:
VALLY_TELEMETRY_OPTOUT: '1'
Expand All @@ -101,6 +107,9 @@ jobs:
run:
needs: select
if: needs.select.outputs.eval_paths != ''
concurrency:
group: skill-eval-comparison-${{ github.event.pull_request.number || github.ref }}-run
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
Comment thread
jongio marked this conversation as resolved.
Resolved
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
Expand All @@ -110,7 +119,7 @@ jobs:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- uses: github/evals-action@3c551330898c1467b8ddf9ef7c7f6e6c6af489d6
- uses: github/evals-action@d7b40d34236f09c8078a2b4e0008ed2ac81919cb
env:
VALLY_TELEMETRY_OPTOUT: '1'
with:
Expand All @@ -123,18 +132,19 @@ jobs:

report:
needs: [select, run-baseline, run]
if: always() && needs.select.outputs.eval_paths != '' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
if: always() && needs.select.outputs.eval_paths != '' && needs.run-baseline.result != 'cancelled' && needs.run.result != 'cancelled' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
actions: read
contents: read
pull-requests: write
concurrency:
# The pinned report action requires this exact, separate group.
group: evals-${{ github.workflow_ref }}
cancel-in-progress: false
steps:
- uses: github/evals-action@3c551330898c1467b8ddf9ef7c7f6e6c6af489d6
- uses: github/evals-action@d7b40d34236f09c8078a2b4e0008ed2ac81919cb
with:
command: report
report-id: evals
Expand Down
161 changes: 161 additions & 0 deletions .github/workflows/update-pins.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
name: Update pins
# Moves remote marketplace pins and github/evals-action pins to their newest releases in one bot PR,
# then enqueues it after required checks pass. Setup: docs/checks-and-evals.md#automatic-pin-updates.
on:
schedule:
- cron: '7,37 * * * *'
workflow_dispatch:
inputs:
dry_run:
description: Report what would change without pushing, opening, or merging a PR.
type: boolean
default: true
workflow_run:
workflows: [Validate]
types: [completed]
branches: [automation/update-pins]
permissions:
contents: read
concurrency:
group: update-pins
cancel-in-progress: false
jobs:
plan:
if: >-
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'schedule' && vars.PIN_AUTOMATION == 'true') ||
(github.event_name == 'workflow_run' && vars.PIN_AUTOMATION == 'true' &&
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.head_repository.full_name == github.repository)
runs-on: ubuntu-latest
Comment thread
jongio marked this conversation as resolved.
Resolved
timeout-minutes: 10
Comment thread
Copilot marked this conversation as resolved.
Resolved
permissions:
contents: read
pull-requests: read
outputs:
changed: ${{ steps.update.outputs.changed }}
open_pr: ${{ steps.update.outputs.open_pr }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: 24
- id: update
env:
GH_TOKEN: ${{ github.token }}
run: node .github/scripts/update-pins.mjs update
Comment thread
jongio marked this conversation as resolved.
Resolved

publish:
needs: plan
if: (needs.plan.outputs.changed == 'true' || needs.plan.outputs.open_pr != '') && !(github.event_name == 'workflow_dispatch' && inputs.dry_run)
environment: pin-automation
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- id: app
uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0
with:
client-id: ${{ vars.PIN_APP_CLIENT_ID }}
private-key: ${{ secrets.PIN_APP_PRIVATE_KEY }}
permission-contents: write
permission-pull-requests: write
permission-workflows: write
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: 24
- id: update
env:
GH_TOKEN: ${{ steps.app.outputs.token }}
run: node .github/scripts/update-pins.mjs update --body-file "$RUNNER_TEMP/pin-pr.md"
- name: Check remote pins
env:
GH_TOKEN: ${{ steps.app.outputs.token }}
run: node .github/scripts/check-remote-pins.mjs
- env:
GH_TOKEN: ${{ steps.app.outputs.token }}
TITLE: ${{ steps.update.outputs.title }}
BOT: ${{ steps.app.outputs.app-slug }}[bot]
run: node .github/scripts/update-pins.mjs publish --title "$TITLE" --body-file "$RUNNER_TEMP/pin-pr.md" --bot "$BOT"

gate:
needs: [plan, publish]
if: >-
always() && needs.plan.result == 'success' &&
!contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') &&
(github.event_name == 'workflow_dispatch' || (vars.PIN_AUTOMATION == 'true' &&
(github.event_name == 'schedule' || github.event.workflow_run.event == 'pull_request')))
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
pull-requests: read
checks: read
statuses: read
actions: read
outputs:
decision: ${{ steps.gate.outputs.decision }}
pr_node_id: ${{ steps.gate.outputs.pr_node_id }}
head: ${{ steps.gate.outputs.head }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: 24
- id: gate
env:
GH_TOKEN: ${{ github.token }}
run: node .github/scripts/update-pins.mjs gate

enqueue:
needs: gate
if: ${{ !cancelled() && needs.gate.result == 'success' && needs.gate.outputs.decision == 'merge' && !(github.event_name == 'workflow_dispatch' && inputs.dry_run) }}
environment: pin-automation
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
pull-requests: read
checks: read
statuses: read
actions: read
steps:
- id: app
uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0
with:
client-id: ${{ vars.PIN_APP_CLIENT_ID }}
private-key: ${{ secrets.PIN_APP_PRIVATE_KEY }}
permission-contents: write
permission-pull-requests: write
Comment thread
jongio marked this conversation as resolved.
Resolved
Comment thread
jongio marked this conversation as resolved.
Resolved
Comment thread
jongio marked this conversation as resolved.
Resolved
permission-workflows: write
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7
with:
node-version: 24
# Recheck with the run's own token (the app can't read checks), pinned to the head the gate approved.
- id: recheck
env:
GH_TOKEN: ${{ github.token }}
BOT: ${{ steps.app.outputs.app-slug }}[bot]
HEAD_SHA: ${{ needs.gate.outputs.head }}
run: node .github/scripts/update-pins.mjs gate --bot "$BOT" --expect-head "$HEAD_SHA"
- if: steps.recheck.outputs.decision == 'merge'
env:
GH_TOKEN: ${{ steps.app.outputs.token }}
PR_NODE_ID: ${{ steps.recheck.outputs.pr_node_id }}
HEAD_SHA: ${{ steps.recheck.outputs.head }}
run: |
gh api graphql \
Comment thread
jongio marked this conversation as resolved.
Resolved
-f query='mutation($input: EnqueuePullRequestInput!) { enqueuePullRequest(input: $input) { mergeQueueEntry { state } } }' \
-F "input[pullRequestId]=$PR_NODE_ID" \
-F "input[expectedHeadOid]=$HEAD_SHA" \
-F 'input[jump]=false'
2 changes: 2 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
pull_request:
push:
branches: [main]
merge_group:
types: [checks_requested]
workflow_dispatch:
permissions:
contents: read
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,8 @@ and per-case transitions) without calling a model. On same-repository pull
requests (`head.repo.full_name == github.repository`, excluding fork PRs),
[Skill eval comparison](.github/workflows/skill-eval-comparison.yml) uses
`github/evals-action` (`report-id: evals-baseline` and
`baseline-report-id: evals-baseline`, introduced in
[github/evals-action#34](https://github.com/github/evals-action/pull/34) at
commit `3c551330898c1467b8ddf9ef7c7f6e6c6af489d6` and included in `@v0` once
released) so any changed skill under
`baseline-report-id: evals-baseline`, pinned to a full commit SHA that
[Update pins](docs/checks-and-evals.md#automatic-pin-updates) advances to each new release) so any changed skill under
`plugins/<plugin>/skills/<skill>/` with a matching
`evals/<plugin>/skills/<skill>/eval.yaml` automatically runs Baseline vs.
Candidate and updates one sticky PR comparison comment; see
Expand Down
Loading
Loading