fix(ci): keep autopilot auto-merge inert without label

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>
This commit is contained in:
Cursor Agent 2026-09-23 11:52:11 +00:00
parent 467d94b5b7
commit 0b5c0ceb61
2 changed files with 13 additions and 16 deletions

View File

@ -34,7 +34,7 @@ These workflows may fail without blocking product delivery. Do **not** add them
## Autopilot auto-merge ## Autopilot auto-merge
Workflow: `.github/workflows/autopilot-auto-merge.yml` Workflow: `.github/workflows/autopilot-auto-merge.yml` (informational — **not** a required check)
1. Open a pull request from an Autopilot/cloud agent. 1. Open a pull request from an Autopilot/cloud agent.
2. Add label **`autopilot`** or **`automerge`**. 2. Add label **`autopilot`** or **`automerge`**.

View File

@ -1,5 +1,6 @@
# Enables GitHub auto-merge for Autopilot PRs once the Product CI gate is green. # Enables GitHub auto-merge for Autopilot PRs once the Product CI gate is green.
# Label a pull request with `autopilot` or `automerge` to opt in. # Label a pull request with `autopilot` or `automerge` to opt in.
# This workflow is informational only — never add it to required status checks.
name: autopilot auto-merge name: autopilot auto-merge
on: on:
@ -14,33 +15,30 @@ permissions:
checks: read checks: read
concurrency: concurrency:
group: autopilot-auto-merge-${{ github.event.pull_request.number || github.event.check_suite.pull_requests[0].number || github.run_id }} group: autopilot-auto-merge-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: false cancel-in-progress: false
jobs: jobs:
auto-merge: auto-merge:
name: Autopilot auto-merge name: Autopilot auto-merge
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: >-
github.event_name == 'pull_request' ||
(github.event_name == 'check_suite' &&
github.event.check_suite.pull_requests[0] != null)
steps: steps:
- name: Resolve pull request - name: Resolve pull request
id: pr id: pr
env: env:
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}
EVENT_NAME: ${{ github.event_name }}
PR_NUMBER: ${{ github.event.pull_request.number }}
CHECK_SUITE_PR: ${{ github.event.check_suite.pull_requests[0].number }}
run: | run: |
set -euo pipefail set -euo pipefail
number="$PR_NUMBER" event_name="${{ github.event_name }}"
if [[ "$EVENT_NAME" == "check_suite" ]]; then number=""
number="$CHECK_SUITE_PR" if [[ "$event_name" == "pull_request" ]]; then
number="${{ github.event.pull_request.number }}"
elif [[ "$event_name" == "check_suite" ]]; then
number="$(jq -r '.check_suite.pull_requests[0].number // empty' "$GITHUB_EVENT_PATH")"
fi fi
if [[ -z "$number" ]]; then if [[ -z "$number" ]]; then
echo "No pull request in event; skipping." >&2 echo "No pull request in event; skipping."
echo "enabled=false" >> "$GITHUB_OUTPUT"
exit 0 exit 0
fi fi
pr_json="$(gh api "repos/${GITHUB_REPOSITORY}/pulls/${number}")" pr_json="$(gh api "repos/${GITHUB_REPOSITORY}/pulls/${number}")"
@ -63,8 +61,7 @@ jobs:
- name: Skip draft pull requests - name: Skip draft pull requests
if: steps.pr.outputs.enabled == 'true' && steps.pr.outputs.draft == 'true' if: steps.pr.outputs.enabled == 'true' && steps.pr.outputs.draft == 'true'
run: | run: echo "Draft pull request; auto-merge waits for ready_for_review."
echo "Draft pull request; auto-merge waits for ready_for_review."
- name: Verify Product CI on head commit - name: Verify Product CI on head commit
id: gate id: gate
@ -91,7 +88,7 @@ jobs:
exit 0 exit 0
;; ;;
failure|cancelled|timed_out|action_required) failure|cancelled|timed_out|action_required)
echo "Product CI failed ($conclusion); not enabling auto-merge." >&2 echo "Product CI failed ($conclusion); not enabling auto-merge."
exit 1 exit 1
;; ;;
esac esac