From cf45ed01ac93c12bb0dda83bc4714db2975e9437 Mon Sep 17 00:00:00 2001 From: shimoncohen Date: Thu, 3 Dec 2026 17:15:39 +0200 Subject: [PATCH 1/2] fix(auto-merge): wait for a new PR's checks to register before watching them gh pr checks --watch exits 1 with "no checks reported" when called before a just-opened PR's checks exist, so the action failed on PRs opened in the same job. The e2e test hit this: the PR was created at 18:02:14 and its checks started at 18:02:18. The action now polls for up to a minute until checks appear; other gh errors still fail at once. --- actions/auto-merge/action.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/actions/auto-merge/action.yaml b/actions/auto-merge/action.yaml index fd1b17d8..4aca02a1 100644 --- a/actions/auto-merge/action.yaml +++ b/actions/auto-merge/action.yaml @@ -83,6 +83,12 @@ runs: run: | set -euo pipefail echo "Waiting for all checks on PR #${{ inputs.pr_number }} to complete" + # Checks of a just-opened PR take a few seconds to register; until then gh reports none and --watch exits 1. + for _ in $(seq 12); do + out=$(gh pr checks "${{ inputs.pr_number }}" --repo "${{ inputs.repository }}" --json name 2>&1) && break + grep -q 'no checks reported' <<< "$out" || { echo "$out" >&2; exit 1; } + sleep 5 + done if gh pr checks "${{ inputs.pr_number }}" \ --repo "${{ inputs.repository }}" \ --watch; then From 2e99d149773f429eb95c291393484580159ea7e8 Mon Sep 17 00:00:00 2001 From: shimoncohen Date: Thu, 3 Dec 2026 17:17:22 +0200 Subject: [PATCH 2/2] ci: check test-site out into its own folder in the auto-merge e2e test Without a path, the test-site checkout replaced this repo in the workspace, so ./actions/auto-merge resolved to the stale copy that test-site carries and the job never tested this repo's action. The empty commit and create-pull-request now use test-site/, which also replaces the repository input create-pull-request does not define. --- .github/workflows/test-auto-merge.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-auto-merge.yaml b/.github/workflows/test-auto-merge.yaml index 52337550..23faac93 100644 --- a/.github/workflows/test-auto-merge.yaml +++ b/.github/workflows/test-auto-merge.yaml @@ -31,9 +31,11 @@ jobs: repository: MapColonies/test-site token: ${{ secrets.GH_PAT }} ref: master + path: test-site persist-credentials: false - name: Create empty commit in test repo + working-directory: test-site run: | git config user.name "GitHub Actions Bot" git config user.email "actions@github.com" @@ -44,7 +46,7 @@ jobs: uses: peter-evans/create-pull-request@v8 with: token: ${{ secrets.GH_PAT }} - repository: MapColonies/test-site + path: test-site branch: "auto-merge-e2e-${{ github.sha }}" base: master title: 'chore: auto-merge e2e test'