-
Notifications
You must be signed in to change notification settings - Fork 39
41 lines (36 loc) · 1.52 KB
/
auto-merge-dependabot.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Auto-merge Dependabot PRs that upgrade patch or minor versions if CI passes
# Copied from https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#enable-auto-merge-on-a-pull-request
# Also see https://github.com/dependabot/fetch-metadata
name: Dependabot auto-merge
on:
pull_request:
branches: main
workflow_dispatch:
permissions:
pull-requests: write
contents: write
jobs:
dependabot:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
if: >
! contains(steps.metadata.outputs.dependency-names, 'tlslite-ng') &&
(steps.metadata.outputs.update-type != 'version-update:semver-major' ||
contains(steps.metadata.outputs.dependency-names, 'certifi'))
# certifi uses calver, not semver
run: gh pr merge --auto --rebase "$PR_URL"
- name: "Warn that we won't auto-merge major version updates"
if: >
! contains(steps.metadata.outputs.dependency-names, 'certifi') &&
steps.metadata.outputs.update-type == 'version-update:semver-major'
run: gh pr comment "$PR_URL" -b "Looks like a major version upgrade! Skipping auto-merge."