Skip to content

Commit

Permalink
ci(workflows): add auto-merge
Browse files Browse the repository at this point in the history
Signed-off-by: Lexus Drumgold <[email protected]>
  • Loading branch information
unicornware committed Mar 3, 2023
1 parent c42da43 commit b17cfd3
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Pull request auto-merge
#
# Automatically merge pull requests after requirements are met.
#
# References:
#
# - https://cli.github.com/manual/gh_pr_merge
# - https://docs.github.com/actions/using-workflows/events-that-trigger-workflows#pull_request
# - https://docs.github.com/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-auto-merge-for-pull-requests-in-your-repository
# - https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request
# - https://github.com/actions/checkout
# - https://github.com/hmarr/debug-action

---
name: auto-merge
on:
pull_request:
types:
- opened
- synchronize
jobs:
auto-merge:
if: github.event.pull_request.auto_merge == null && github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- id: debug
name: Print environment variables and event payload
uses: hmarr/[email protected]
- id: checkout
name: Checkout ${{ github.head_ref }}
uses: actions/[email protected]
with:
ref: ${{ github.head_ref }}
- id: auto-merge
name: Enable auto-merge
run: gh pr merge ${{ github.event.pull_request.number }} --auto --squash
env:
GITHUB_TOKEN: ${{ secrets.PAT_REPO }}
6 changes: 0 additions & 6 deletions .github/workflows/dependabot-auto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ jobs:
persist-credentials: ${{ steps.metadata.outputs.package-ecosystem == 'npm_and_yarn' }}
ref: ${{ github.head_ref }}
token: ${{ env.GITHUB_TOKEN }}
- id: enable-auto-merge
name: Enable auto-merge
if: |
steps.metadata.outputs.package-ecosystem == 'github_actions' ||
steps.metadata.outputs.update-type != 'version-update:semver-major'
run: gh pr merge ${{ github.event.number }} --auto --squash
- id: gpg-import
name: Import GPG key
if: steps.metadata.outputs.package-ecosystem == 'npm_and_yarn'
Expand Down

0 comments on commit b17cfd3

Please sign in to comment.