Skip to content
Merged
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
31 changes: 26 additions & 5 deletions .github/workflows/_release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@
# Automates versioning and changelog via conventional commits.
#
# All release configuration is inlined as action inputs.
# Calling repos should pass secrets explicitly:
# Calling repos should pass secrets and permissions explicitly:
#
# jobs:
# release-please:
# permissions:
# contents: read
# pull-requests: write
# uses: JacobPEvans/.github/.github/workflows/_release-please.yml@main
# secrets:
# GH_ACTION_JACOBPEVANS_APP_ID: ${{ secrets.GH_ACTION_JACOBPEVANS_APP_ID }}
# GH_APP_PRIVATE_KEY: ${{ secrets.GH_APP_PRIVATE_KEY }}
#
# Org/repo prerequisites:
# "Allow GitHub Actions to create and approve pull requests" must be enabled
# Calling repos must grant `pull-requests: write` in the caller job permissions
#
# Required files in each calling repo:
# VERSION - plain-text current version (e.g. "1.2.3")
# .release-please-manifest.json - release-please manifest (e.g. {"." : "1.2.3"})
Expand Down Expand Up @@ -42,6 +49,7 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v6

Expand Down Expand Up @@ -78,13 +86,26 @@ jobs:
]
manifest-file: .release-please-manifest.json

- name: Enable auto-merge for release PR
- name: Find release PR number
id: find-pr
if: steps.release.outputs.prs_created == 'true'
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
BASE_BRANCH: ${{ github.ref_name }}
run: |
PR_NUMBER=$(gh pr list --head "release-please--branches--${BASE_BRANCH}" --json number --jq '.[0].number // empty')
if [ -n "$PR_NUMBER" ]; then
gh pr merge "$PR_NUMBER" --auto --squash
fi
echo "number=$PR_NUMBER" >> $GITHUB_OUTPUT

- name: Enable auto-merge for release PR
if: steps.find-pr.outputs.number != ''
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
PR_NUMBER: ${{ steps.find-pr.outputs.number }}
run: gh pr merge "$PR_NUMBER" --auto --squash

- name: Approve release PR
if: steps.find-pr.outputs.number != ''
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ steps.find-pr.outputs.number }}
run: gh pr review "$PR_NUMBER" --approve