From a91d35547c773f4160534414c9e7d1d2ccbfa033 Mon Sep 17 00:00:00 2001 From: Lexus Drumgold Date: Tue, 11 Apr 2023 18:08:52 -0400 Subject: [PATCH] ci(workflows): add `auto-merge` Signed-off-by: Lexus Drumgold --- .github/workflows/auto-merge.yml | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/auto-merge.yml diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml new file mode 100644 index 00000000..1a3b92df --- /dev/null +++ b/.github/workflows/auto-merge.yml @@ -0,0 +1,41 @@ +# 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/learn-github-actions/contexts +# - https://docs.github.com/actions/using-workflows/events-that-trigger-workflows#pull_request +# - https://docs.github.com/actions/using-workflows/using-github-cli-in-workflows +# - 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 +env: + GITHUB_TOKEN: ${{ secrets.PAT_REPO }} +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/debug-action@v2.1.0 + - id: checkout + name: Checkout ${{ github.head_ref }} + uses: actions/checkout@v3.5.0 + with: + persist-credentials: false + ref: ${{ github.head_ref }} + - id: enable + name: Enable auto-merge + run: gh pr merge ${{ github.event.number }} --auto --squash