diff --git a/.github/workflows/integration-batch.yml b/.github/workflows/integration-batch.yml index eac45447d..e74344cd8 100644 --- a/.github/workflows/integration-batch.yml +++ b/.github/workflows/integration-batch.yml @@ -242,8 +242,26 @@ jobs: existing="$(gh pr list --repo "$REPO" --state open --head integration --base main --json number --jq '.[0].number // empty')" if [ -n "$existing" ]; then gh pr edit "$existing" --repo "$REPO" --title "integration" --body "$body" + integration_pr_number="$existing" else gh pr create --repo "$REPO" --head integration --base main --title "integration" --body "$body" + integration_pr_number="" + max_attempts=5 + for _ in $(seq 1 "$max_attempts"); do + integration_pr_number="$(gh pr list --repo "$REPO" --state open --head integration --base main --json number --jq '.[0].number // empty')" + if [[ "$integration_pr_number" =~ ^[0-9]+$ ]]; then + break + fi + sleep 2 + done + if ! [[ "$integration_pr_number" =~ ^[0-9]+$ ]]; then + echo "Unable to resolve integration PR number after $max_attempts retry attempts" >&2 + exit 1 + fi + fi + + if echo "$snapshot_updates" | jq -e '.files | length > 0' >/dev/null; then + gh pr edit "$integration_pr_number" --repo "$REPO" --add-label integration-needs-snapshot-review fi - name: Job summary diff --git a/docs/INTEGRATION.md b/docs/INTEGRATION.md index f15e4559a..e9699242c 100644 --- a/docs/INTEGRATION.md +++ b/docs/INTEGRATION.md @@ -7,6 +7,7 @@ The [`integration-batch` workflow](../.github/workflows/integration-batch.yml) a - `integration-batch`: PR is queued for integration batching. - `integrated`: PR was successfully merged into the `integration` branch by automation. - `integration-failed`: automation attempted integration but hit a merge conflict. +- `integration-needs-snapshot-review`: generated `integration -> main` PR where snapshot auto-recovery updated snapshot files. ## Selection rules