diff --git a/.github/workflows/rig-integration.yml b/.github/workflows/rig-integration.yml index 3de3c6c..64b0f93 100644 --- a/.github/workflows/rig-integration.yml +++ b/.github/workflows/rig-integration.yml @@ -24,5 +24,5 @@ jobs: - name: Run integration tests env: RIG_REQUIRE_COPILOT_INTEGRATION: "1" - COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} + COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN || github.token }} run: npm run test:integration diff --git a/README.md b/README.md index b4c52e0..587ff76 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ node skills/rig/run.ts review.ts --typecheck ## Live Copilot integration tests -Run `npm run test:integration` with `COPILOT_GITHUB_TOKEN` for the local CLI transport, or with `COPILOT_SDK_URI` for a running SDK endpoint (also supply `COPILOT_CONNECTION_TOKEN` if the endpoint requires it). Without either transport, the suite reports a skip. Set `RIG_REQUIRE_COPILOT_INTEGRATION=1` to fail instead, as the Rig Integration Tests workflow does. +Run `npm run test:integration` with `COPILOT_GITHUB_TOKEN` for the local CLI transport, or with `COPILOT_SDK_URI` for a running SDK endpoint (also supply `COPILOT_CONNECTION_TOKEN` if the endpoint requires it). Without either transport, the suite reports a skip. Set `RIG_REQUIRE_COPILOT_INTEGRATION=1` to fail instead, as the Rig Integration Tests workflow does. That workflow uses the `COPILOT_GITHUB_TOKEN` secret when configured, otherwise its automatic `github.token` with `copilot-requests: write` permission. ## In agentic workflows diff --git a/src/rig-integration-workflow.test.ts b/src/rig-integration-workflow.test.ts new file mode 100644 index 0000000..1fb267a --- /dev/null +++ b/src/rig-integration-workflow.test.ts @@ -0,0 +1,16 @@ +import { readFileSync } from "node:fs"; +import { describe, expect, it } from "vitest"; + +const workflow = readFileSync(new URL("../.github/workflows/rig-integration.yml", import.meta.url), "utf8"); + +describe("Rig Integration Tests workflow", () => { + it("falls back to the workflow token with Copilot request permission", () => { + expect(workflow).toContain("COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN || github.token }}"); + expect(workflow).toContain("copilot-requests: write"); + }); + + it("requires live integration rather than silently skipping tests", () => { + expect(workflow).toContain('RIG_REQUIRE_COPILOT_INTEGRATION: "1"'); + expect(workflow).toContain("run: npm run test:integration"); + }); +});