diff --git a/.github/workflows/add_label.yml b/.github/workflows/add_label.yml new file mode 100644 index 000000000..966cb33d8 --- /dev/null +++ b/.github/workflows/add_label.yml @@ -0,0 +1,14 @@ +name: 'Add Label "automerge"' + +on: + pull_request: + types: opened + +jobs: + add_label: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions-ecosystem/action-add-labels@v1 + with: + labels: automerge diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml new file mode 100644 index 000000000..257488da6 --- /dev/null +++ b/.github/workflows/automerge.yml @@ -0,0 +1,32 @@ +name: Squash, Merge & Lock + +on: issue_comment + +jobs: + squash_merge: + if: ${{ github.event.issue.pull_request && github.event.comment.author_association == 'OWNER' }} + runs-on: ubuntu-latest + outputs: + merged: ${{ steps.squashmerge.outputs.mergeResult == 'merged' }} + steps: + - name: Squash & Merge + id: squashmerge + if: startsWith(github.event.comment.body, '/merge') + uses: "pascalgn/automerge-action@v0.15.5" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MERGE_METHOD: "squash" + MERGE_COMMIT_MESSAGE: "(#${{ github.event.issue.number }}) ${{ github.event.issue.title }}" + MERGE_REMOVE_LABELS: "automerge" + + lock_PR: + needs: squash_merge + runs-on: ubuntu-latest + steps: + - if: ${{ needs.squash_merge.outputs.merged }} + name: lock PR + uses: sudo-bot/action-pull-request-lock@v1.1.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + number: ${{ github.event.issue.number }} +