Skip to content

Commit

Permalink
fix(ci/automerge): use PAT token
Browse files Browse the repository at this point in the history
- GitHub does not allow ordinary GITHUB_TOKEN to trigger other
  workflows, probably to avoid endless recursion
- using PAT might fix this

Signed-off-by: AtomicFS <[email protected]>
  • Loading branch information
AtomicFS committed Nov 15, 2024
1 parent 9216098 commit 78d4e40
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"acpica",
"addinivalue",
"addoption",
"automerge",
"autopep",
"blkio",
"bsdmainutils",
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/bot--automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ permissions: read-all

jobs:
# Enable auto-merge on all pull requests by default
# Docs: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#enable-auto-merge-on-a-pull-request
enable-auto-merge:
runs-on: ubuntu-latest
permissions:
Expand All @@ -21,12 +22,14 @@ jobs:
uses: actions/checkout@v4
- name: Enable pull request auto-merge
run: |
gh pr merge --auto "${{ github.event.pull_request.number }}"
gh pr merge --auto "${PR_URL}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GH_PAT_AUTOMERGE }}
PR_URL: ${{ github.event.pull_request.html_url }}

# If PR is made by dependabot, automatically approve the PR
# Linting and all checks will still have to pass in order for the PR to be merged
# Docs: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#approve-a-pull-request
auto-approve-dependabot:
runs-on: ubuntu-latest
permissions:
Expand All @@ -36,8 +39,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Auto approve dependabot pull requests
if: github.actor == 'dependabot[bot]'
if: ${{ github.actor == 'dependabot[bot]' }}
run: |
gh pr review "${{ github.event.pull_request.number }}" --approve
gh pr review "${PR_URL}" --approve
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_URL: ${{ github.event.pull_request.html_url }}

0 comments on commit 78d4e40

Please sign in to comment.