Skip to content

Commit

Permalink
PR auto-merge only if reviewers > 0
Browse files Browse the repository at this point in the history
Co-authored-by: Kyle Harding <kyle@balena.io>
Change-type: patch
  • Loading branch information
ab77 and klutchell committed Dec 8, 2022
1 parent 1aea10a commit 196fa81
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 25 deletions.
28 changes: 17 additions & 11 deletions .github/workflows/flowzone.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 13 additions & 14 deletions flowzone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -820,20 +820,6 @@ jobs:
exit 1
fi
# if auto_merge is enabled at the repository level, configure PR auto-merge
- name: Enable PR auto-merge
if: |
github.event.pull_request.draft == false &&
needs.event_types.outputs.do_draft == 'true' &&
inputs.repo_config == true
run: |
if [[ '${{ inputs.repo_enable_auto_merge }}' =~ true ]]; then
gh pr merge ${{ github.event.pull_request.number }} --merge --auto
fi
env:
GH_TOKEN: ${{ secrets.FLOWZONE_TOKEN }}

- name: Import GPG key for signing commits
if: inputs.disable_versioning != true && needs.event_types.outputs.pr == 'true'
id: import-gpg
Expand Down Expand Up @@ -2147,6 +2133,9 @@ jobs:
BRANCH_PROTECTION_URI: repos/${{ github.repository }}/branches/${{ github.event.repository.default_branch }}/protection
GH_TOKEN: ${{ secrets.FLOWZONE_TOKEN }}
steps:
- *downloadSourceArtifact
- *extractSourceArtifact

# loop over all needed jobs and fail this job if any of them failed
- name: Check needed jobs
run: |
Expand Down Expand Up @@ -2270,6 +2259,16 @@ jobs:
echo "${result}" >> $GITHUB_OUTPUT
echo "${DELIMITER}" >> $GITHUB_OUTPUT
# if auto_merge is enabled at the repository level, configure PR auto-merge
- name: Enable PR auto-merge
if: github.event.pull_request.draft == false
run: |
if [[ $(gh api '/repos/${{ github.repository }}' | jq -r .allow_auto_merge) =~ true ]]; then
if [[ ${{ inputs.required_approving_review_count }} -gt 0 ]]; then
gh pr merge ${{ github.event.pull_request.number }} --merge --auto
fi
fi
###################################################
## configure standard repository settings
###################################################
Expand Down

0 comments on commit 196fa81

Please sign in to comment.