-
Notifications
You must be signed in to change notification settings - Fork 3
Add Dependabot auto-merge workflow #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,15 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Auto-approve Dependabot PRs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| auto-approve: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: github.actor == 'dependabot[bot]' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Auto-approve and merge Dependabot PRs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+11
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | |
| - name: Auto-approve and merge Dependabot PRs | |
| steps: | |
| - name: Wait for required status checks | |
| uses: actions/github-script@v6 | |
| id: check-status | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const pr = await github.rest.pulls.get({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: context.issue.number, | |
| }); | |
| const sha = pr.data.head.sha; | |
| const checks = await github.rest.checks.listForRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: sha, | |
| }); | |
| const failed = checks.data.check_runs.filter( | |
| c => c.status === "completed" && c.conclusion !== "success" | |
| ); | |
| if (failed.length > 0) { | |
| core.setFailed("Some required status checks have not passed."); | |
| } | |
| - name: Auto-approve and merge Dependabot PRs | |
| if: steps.check-status.outcome == 'success' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow triggers on all
pull_requestevents but only processes Dependabot PRs. Consider usingpull_request_targetevent with type filters like[opened, synchronize, reopened]to better control when this workflow runs, or addtypesto thepull_requesttrigger to avoid unnecessary workflow executions.