Skip to content

Commit

Permalink
ci: migrate auto-merge to gh cli
Browse files Browse the repository at this point in the history
- Simplify permissions by removing specific action permissions
- Update the GitHub token reference in the auto-approve step
- Remove the Auto_Merge_PR job and its associated steps
- Add a step to check out the repository using `actions/checkout@v4`
- Replace the automerge actions with a direct GitHub CLI command to merge pull requests

Signed-off-by: 陳鈞 <[email protected]>
  • Loading branch information
jim60105 committed Oct 20, 2024
1 parent 46e3b1f commit fecc47f
Showing 1 changed file with 9 additions and 22 deletions.
31 changes: 9 additions & 22 deletions .github/workflows/AutoMerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ on:
pull_request:

permissions:
# Permission to trigger the minify workflow
actions: write
pull-requests: write

jobs:
Expand All @@ -18,25 +16,14 @@ jobs:
- name: Auto approve
uses: hmarr/auto-approve-action@v4
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
github-token: "${{ github.token }}"

Auto_Merge_PR:
name: Auto Merge PR
runs-on: ubuntu-latest
needs: "Auto_Approve"
steps:
- uses: actions/checkout@v4
- name: Git Auto Merge
uses: plm9606/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
merge-method: merge
reviewers-number: 0
label-name: "automerge"

- name: Remove label
if: ${{ success() }}
uses: buildsville/[email protected]
with:
token: ${{secrets.GITHUB_TOKEN}}
label: "automerge"
type: remove
env:
GH_TOKEN: ${{ secrets.CR_PAT }}
run: |
gh pr merge --merge \
--auto \
${{ github.event.pull_request.number }} \
shell: bash

0 comments on commit fecc47f

Please sign in to comment.