Skip to content

Commit

Permalink
🤖 Auto approve go dep PRs by dependabot (#1423)
Browse files Browse the repository at this point in the history
3rd try

dependabot doesn't work with the provided token.

Signed-off-by: Christian Zunker <[email protected]>
  • Loading branch information
czunker authored Sep 9, 2024
1 parent 15a6768 commit c812104
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/pr-test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ jobs:

go-auto-approve:
runs-on: ubuntu-latest
needs: go-test
needs: [go-test, go-bench, golangci-lint, go-mod]
# For now, we only auto approve and merge go dep PRs because we have tests for this in place.
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions#startswith
if: ${{ startsWith(github.ref, 'refs/heads/dependabot/go_modules') && github.actor == 'dependabot[bot]' && needs.go-test.outputs.outcome == 'success' }}
if: ${{ startsWith(github.ref, 'refs/heads/dependabot/go_modules') && github.actor == 'dependabot[bot]' }}
permissions:
contents: write
pull-requests: write
Expand All @@ -106,12 +106,9 @@ jobs:
filterOutClosed: true
filterOutDraft: true
- name: Approve a PR
# Settings the comment will auto merge the PR after all tests passed
# https://docs.github.com/en/enterprise-cloud@latest/code-security/dependabot/working-with-dependabot/managing-pull-requests-for-dependency-updates#managing-dependabot-pull-requests-with-comment-commands
run: gh pr review "$PR_URL" --approve --body "@dependabot squash and merge"
env:
PR_URL: ${{ steps.pr.outputs.url }}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
uses: fastify/github-action-merge-dependabot@v3
with:
pr-number: ${{ steps.pr.outputs.number }}

event_file:
name: "Store event file"
Expand Down

0 comments on commit c812104

Please sign in to comment.