Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,33 @@ jobs:
run: |
mapfile -t policies < <(grep '[^[:space:]]' <<< "$POLICIES" | sed -E 's/^[[:space:]]+|[[:space:]]+$//g')
python3 ../foundation/release/reconcile-release-prs.py "${policies[@]}"
# release-please recomputes everything from the main HEAD and updates the open release PR, so a transient
# API failure is retried once instead of stranding the release PR (nothing else re-triggers this workflow).
- id: release
continue-on-error: true
uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
with:
token: ${{ steps.app.outputs.token }}
config-file: ${{ inputs.config-file }}
manifest-file: ${{ inputs.manifest-file }}
skip-github-release: true
- name: Wait before retrying release-please
if: steps.release.outcome == 'failure'
run: sleep 20
- id: release-retry
if: steps.release.outcome == 'failure'
uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
with:
token: ${{ steps.app.outputs.token }}
config-file: ${{ inputs.config-file }}
manifest-file: ${{ inputs.manifest-file }}
skip-github-release: true
# Re-armed on every run: pushing to a release PR disarms auto-merge, and the head is pinned.
# Skipped when both attempts fail: arming after a partial release-please update could publish unchecked content.
- name: Arm auto-merge on release PRs
if: inputs.auto-merge
working-directory: caller
env:
RELEASE_PR_APP_TOKEN: ${{ steps.app.outputs.token }}
RELEASE_PRS: ${{ steps.release.outputs.prs }}
RELEASE_PRS: ${{ steps.release.outcome == 'success' && steps.release.outputs.prs || steps.release-retry.outputs.prs }}
run: python3 ../foundation/release/arm-release-pr-auto-merge.py
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -732,4 +732,4 @@ Release-please is the only way to prepare releases in an adopting repository: `.

### Auto-merging release PRs

With `auto-merge: true`, `release-please.yml` arms squash auto-merge on every open release PR (label `autorelease: pending`) through [`release/arm-release-pr-auto-merge.py`](release/arm-release-pr-auto-merge.py): the commit title is the PR title and the head commit is pinned, so a later push disarms it until the next run re-arms it. The release PR then merges as soon as the required checks pass, and the release is tagged and published **without human review**. Prerequisites in the adopting repository: `allow_auto_merge`, no required review, squash merges with `PR_TITLE` as the commit title, and the `pr-title` check required (all enforced by `github-config` for repositories with `release_pr: true`). Activate `auto-merge` only after those are in place. The PRs reported by `release-please-action` are armed as well, because the label listing can lag behind a PR opened seconds earlier. Only PRs from a `release-please--*` branch of the repository itself are armed, whatever their labels. A PR that GitHub refuses to arm and whose REST merge state (`mergeable_state`, re-read up to five times while it is `unknown`) is `clean` is squash merged directly with the same title and the pinned head: the branch rules still apply, and no later run would arm it.
With `auto-merge: true`, `release-please.yml` arms squash auto-merge on every open release PR (label `autorelease: pending`) through [`release/arm-release-pr-auto-merge.py`](release/arm-release-pr-auto-merge.py): the commit title is the PR title and the head commit is pinned, so a later push disarms it until the next run re-arms it. The release PR then merges as soon as the required checks pass, and the release is tagged and published **without human review**. Prerequisites in the adopting repository: `allow_auto_merge`, no required review, squash merges with `PR_TITLE` as the commit title, and the `pr-title` check required (all enforced by `github-config` for repositories with `release_pr: true`). Activate `auto-merge` only after those are in place. The PRs reported by `release-please-action` are armed as well, because the label listing can lag behind a PR opened seconds earlier. Only PRs from a `release-please--*` branch of the repository itself are armed, whatever their labels. A PR that GitHub refuses to arm and whose REST merge state (`mergeable_state`, re-read up to five times while it is `unknown`) is `clean` is squash merged directly with the same title and the pinned head: the branch rules still apply, and no later run would arm it. `release-please-action` is run a second time after a 20 s pause when its first run fails (it recomputes from the `main` HEAD and updates the open release PR, so it is safe to repeat): a transient GitHub API error no longer strands the release PR, which nothing else would re-trigger. Arming happens only after a successful run; when both runs fail the job fails and nothing is armed, because a partial update could leave the PR title (the squash commit and tag) out of step with its branch.