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' 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