diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8b07ab..859d44b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,12 +118,32 @@ jobs: npm ci npx playwright install chromium + # The same rule as agentage/kit: head, a non-default base, vars.E2E_REF, master. + - name: Pick the agentage/e2e branch + id: e2e-ref + if: env.SECRETS_OK == 'true' + env: + E2E_REF: ${{ vars.E2E_REF }} + GH_TOKEN: ${{ secrets.PAT_TOKEN }} + run: | + branch="${E2E_REF:-master}" + why="${E2E_REF:+variable E2E_REF}"; why="${why:-default master}" + # The base counts only when it is another PR's branch: a PR on master falls to the variable. + base="${GITHUB_BASE_REF:-}" + if [ "$base" = "${{ github.event.repository.default_branch }}" ]; then base=""; fi + for ref in "$base" "${GITHUB_HEAD_REF:-}"; do + if [ -n "$ref" ] && gh api "repos/agentage/e2e/branches/$ref" --silent 2>/dev/null; then branch="$ref"; why="same-name branch"; fi + done + echo "e2e branch: $branch ($why)" | tee -a "$GITHUB_STEP_SUMMARY" + echo "branch=$branch" >> "$GITHUB_OUTPUT" + # agentage/e2e is private (the org PAT_TOKEN reads it); Dependabot and fork runs get no secrets. - name: Checkout agentage/e2e if: env.SECRETS_OK == 'true' uses: actions/checkout@v7 with: repository: agentage/e2e + ref: ${{ steps.e2e-ref.outputs.branch }} path: e2e-suite token: ${{ secrets.PAT_TOKEN }} persist-credentials: false diff --git a/README.md b/README.md index c2c9450..910f852 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ npm run verify # type-check, lint, format, tests with coverag npx agentage extension check # the kit's six rules ``` -CI runs `verify`, `check`, `agentage extension up --docker` and the e2e tests for each folder that a change touches. A change outside `extensions/` tests all folders. The job `ci-required` is green when all of them pass. +CI runs `verify`, `check`, `agentage extension up --docker` and the e2e tests for each folder that a change touches. A change outside `extensions/` tests all folders. The job `ci-required` is green when all of them pass. A pull request is tested against the agentage/e2e branch of the same name when it exists, else the repo variable `E2E_REF`, else master. To start a new extension, run `npx @agentage/cli@latest extension create --no-install`. The template comes from [agentage/kit](https://github.com/agentage/kit).