Skip to content
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

DX-208 <update automerge> #107

Merged
merged 6 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/automerge-dependabot-with-codeowners.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Auto-merge dependabot PR's

on:
workflow_call:
secrets:
github-token:
required: true

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
name: Dependabot auto-merge
runs-on: [self-hosted, nonroot]
timeout-minutes: 15
if: ${{ github.actor == 'dependabot[bot]' }}

steps:
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.github-token }}"

- name: Check PR checks
run: |
PR_URL="${{ github.event.pull_request.html_url }}"
gh pr checks $PR_URL --required --watch --fail-fast > /dev/null
env:
GITHUB_TOKEN: ${{ secrets.github-token }}

- name: Enable auto-merge for Dependabot PRs
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
GersonTrj marked this conversation as resolved.
Show resolved Hide resolved
run: gh pr merge --auto --squash --admin "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.github-token }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
## Merge dependabot PRs automatically

To auto-merge Dependabot PRs, add this to the end of your lint and test workflow so that the automerge only gets triggered after the tests are successful:
If you have codeowners on your project change for automerge-dependabot-with-codeowners.yml@main

```yaml
automerge:
Expand Down