Skip to content

Commit c1cfd45

Browse files
authored
Merge pull request #119 from ahoppen/auto-merge-draft
Mark automerge PRs as draft
2 parents 2eadfe9 + 41b324c commit c1cfd45

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/create_automerge_pr.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ name: Create automerge PR
99
#
1010
# Example usage in a repository:
1111
#
12+
# ```
1213
# name: Create PR to merge main into release branch
1314
#
1415
# # In the first period after branching the release branch, we typically want to include all changes from `main` also in the release branch. This workflow automatically creates a PR every Monday to merge main into the release branch.
@@ -29,7 +30,15 @@ name: Create automerge PR
2930
# pull-requests: write
3031
# with:
3132
# base_branch: release/6.2
32-
33+
# ```
34+
#
35+
# PRs created by GitHub Actions don't kick off further actions (https://github.com/peter-evans/create-pull-request/blob/d57e551ebc1a16dee0b8c9ea6d24dba7627a6e35/docs/concepts-guidelines.md#triggering-further-workflow-runs).
36+
# As a workaround, we mark automerge PRs that are created by GitHub actions as draft and trigger the GitHub actions by marking the PR as ready for review. But we don't want to re-trigger testing this when a normal user's PR is marked as ready for review.
37+
# For this the pull request workflow in the repository needs to add the `ready_for_review` type to its `pull_request` trigger and add the following condition as an `if` condition to all jobs:
38+
#
39+
# ```
40+
# if: (github.event.action != 'ready_for_review') || (github.event.action == 'ready_for_review' && github.event.pull_request.user.login == 'github-actions[bot]')
41+
# ```
3342
on:
3443
workflow_call:
3544
inputs:
@@ -90,4 +99,5 @@ jobs:
9099
--base "${{ inputs.base_branch }}" \
91100
--head "$PR_BRANCH" \
92101
--title 'Merge `${{ inputs.head_branch }}` into `${{ inputs.base_branch }}`' \
93-
--body '${{ inputs.pr_message }}'
102+
--body '${{ inputs.pr_message }}' \
103+
--draft

0 commit comments

Comments
 (0)