fix(ci): keep autopilot auto-merge inert without label
Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>
This commit is contained in:
parent
467d94b5b7
commit
0b5c0ceb61
2
.github/MERGE_GATES.md
vendored
2
.github/MERGE_GATES.md
vendored
@ -34,7 +34,7 @@ These workflows may fail without blocking product delivery. Do **not** add them
|
||||
|
||||
## 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.
|
||||
2. Add label **`autopilot`** or **`automerge`**.
|
||||
|
||||
27
.github/workflows/autopilot-auto-merge.yml
vendored
27
.github/workflows/autopilot-auto-merge.yml
vendored
@ -1,5 +1,6 @@
|
||||
# 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.
|
||||
# This workflow is informational only — never add it to required status checks.
|
||||
name: autopilot auto-merge
|
||||
|
||||
on:
|
||||
@ -14,33 +15,30 @@ permissions:
|
||||
checks: read
|
||||
|
||||
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
|
||||
|
||||
jobs:
|
||||
auto-merge:
|
||||
name: Autopilot auto-merge
|
||||
runs-on: ubuntu-latest
|
||||
if: >-
|
||||
github.event_name == 'pull_request' ||
|
||||
(github.event_name == 'check_suite' &&
|
||||
github.event.check_suite.pull_requests[0] != null)
|
||||
steps:
|
||||
- name: Resolve pull request
|
||||
id: pr
|
||||
env:
|
||||
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: |
|
||||
set -euo pipefail
|
||||
number="$PR_NUMBER"
|
||||
if [[ "$EVENT_NAME" == "check_suite" ]]; then
|
||||
number="$CHECK_SUITE_PR"
|
||||
event_name="${{ github.event_name }}"
|
||||
number=""
|
||||
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
|
||||
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
|
||||
fi
|
||||
pr_json="$(gh api "repos/${GITHUB_REPOSITORY}/pulls/${number}")"
|
||||
@ -63,8 +61,7 @@ jobs:
|
||||
|
||||
- name: Skip draft pull requests
|
||||
if: steps.pr.outputs.enabled == 'true' && steps.pr.outputs.draft == 'true'
|
||||
run: |
|
||||
echo "Draft pull request; auto-merge waits for ready_for_review."
|
||||
run: echo "Draft pull request; auto-merge waits for ready_for_review."
|
||||
|
||||
- name: Verify Product CI on head commit
|
||||
id: gate
|
||||
@ -91,7 +88,7 @@ jobs:
|
||||
exit 0
|
||||
;;
|
||||
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
|
||||
;;
|
||||
esac
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user