Skip to content

Commit

Permalink
ci: migrate auto-merge to gh cli
Browse files Browse the repository at this point in the history
- Add `contents: write` permission to the workflow
- Update token reference from `secrets.GITHUB_TOKEN` to `${{ github.token }}`
- Remove `Auto_Merge_PR` job and associated steps
- Add environment variable `GH_TOKEN` and merge pull request using `gh` command in the `Auto_Approve` job

Signed-off-by: 陳鈞 <[email protected]>
  • Loading branch information
jim60105 committed Oct 20, 2024
1 parent 46e3b1f commit 61375b0
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions .github/workflows/AutoMerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ permissions:
# Permission to trigger the minify workflow
actions: write
pull-requests: write
contents: write

jobs:
Auto_Approve:
Expand All @@ -18,25 +19,13 @@ 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:
- 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: ${{ github.token }}
run: |
gh pr merge --merge \
--auto \
${{ github.event.pull_request.number }} \
shell: bash

0 comments on commit 61375b0

Please sign in to comment.