Skip to content

Commit 9bda708

Browse files
authored
Enable auto-merge for dependabot & docwhat (#8)
Auto-approve and auto-merge dependabot PRs and auto-emerge docwhat PRs.
1 parent 1fca85f commit 9bda708

File tree

4 files changed

+101
-7
lines changed

4 files changed

+101
-7
lines changed

.github/CODEOWNERS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/.github/ @docwhat
2+
3+
* @docwhat
4+
5+
# EOF
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Automatically Update Dependencies
2+
3+
# `pull_request_target` grants access to secrets and runs in the scope of the *destination* branch.
4+
# Specifically we listen for the labelled event.
5+
on:
6+
pull_request_target:
7+
types:
8+
# Dependabot will label the PR
9+
- labeled
10+
# Dependabot has rebased the PR
11+
- synchronize
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
enable-dependabot-automerge:
18+
name: Enable auto-merge for Dependabot PRs
19+
runs-on: ubuntu-latest
20+
permissions:
21+
# enable-automerge is a graphql query, not REST, so isn't documented,
22+
# except in a mention in
23+
# https://github.blog/changelog/2021-02-04-pull-request-auto-merge-is-now-generally-available/
24+
# which says "can only be enabled by users with permissino to merge"; the
25+
# REST documentation says you need contents: write to perform a merge.
26+
# https://github.community/t/what-permission-does-a-github-action-need-to-call-graphql-enablepullrequestautomerge/197708
27+
# says this is it
28+
contents: write
29+
# Specifically check the creator of the pull-request, not the actor.
30+
if: github.event.pull_request.user.login == 'dependabot[bot]' && contains(github.event.pull_request.labels.*.name, 'dependencies')
31+
32+
steps:
33+
- name: Enable GitHub Auto-Merge
34+
# Reference by commit SHA as it is an immutable reference to a
35+
# known, "trusted" version of this 3rd party code.
36+
uses: alexwilson/enable-github-automerge-action@56e3117d1ae1540309dc8f7a9f2825bc3c5f06ff
37+
with:
38+
github-token: "${{ secrets.GITHUB_TOKEN }}"
39+
40+
approve-dependabot:
41+
needs: enable-dependabot-automerge
42+
runs-on: ubuntu-latest
43+
permissions:
44+
# https://github.com/hmarr/auto-approve-action/issues/183 says
45+
# auto-approve-action requires write on pull-requests
46+
pull-requests: write
47+
# Specifically check the creator of the pull-request, not the actor.
48+
if: github.event.pull_request.user.login == 'dependabot[bot]' && contains(github.event.pull_request.labels.*.name, 'dependencies')
49+
steps:
50+
- name: Approve dependabot PRs
51+
# Reference by commit SHA as it is an immutable reference to a
52+
# known, "trusted" version of this 3rd party code.
53+
uses: hmarr/auto-approve-action@8f929096a962e83ccdfa8afcf855f39f12d4dac7
54+
with:
55+
github-token: "${{ secrets.GITHUB_TOKEN }}"
56+
# EOF
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Auto-Merge for docwhat
2+
3+
# `pull_request_target` grants access to secrets and runs in the scope of the *destination* branch.
4+
# Specifically we listen for the labelled event.
5+
on:
6+
pull_request_target:
7+
types:
8+
- labeled
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
enable-auto-merge-for-docwhat:
15+
name: Enable Auto-Merge for docwhat
16+
runs-on: ubuntu-latest
17+
permissions:
18+
# enable-automerge is a graphql query, not REST, so isn't documented,
19+
# except in a mention in
20+
# https://github.blog/changelog/2021-02-04-pull-request-auto-merge-is-now-generally-available/
21+
# which says "can only be enabled by users with permissino to merge"; the
22+
# REST documentation says you need contents: write to perform a merge.
23+
# https://github.community/t/what-permission-does-a-github-action-need-to-call-graphql-enablepullrequestautomerge/197708
24+
# says this is it
25+
contents: write
26+
# Specifically check that dependabot (or another trusted party) created this pull-request, and that it has been labelled correctly.
27+
if: github.event.pull_request.user.login == 'docwhat'
28+
steps:
29+
- name: Enable GitHub Auto-Merge
30+
uses: alexwilson/enable-github-automerge-action@56e3117d1ae1540309dc8f7a9f2825bc3c5f06ff
31+
with:
32+
github-token: "${{ secrets.GITHUB_TOKEN }}"
33+
# EOF

.trunk/trunk.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cli:
77
plugins:
88
sources:
99
- id: trunk
10-
ref: v1.6.0
10+
ref: v1.6.1
1111
uri: https://github.com/trunk-io/plugins
1212
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
1313
runtimes:
@@ -18,21 +18,21 @@ runtimes:
1818
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
1919
lint:
2020
enabled:
21-
- bandit@1.7.8
21+
- bandit@1.7.9
2222
- black@24.4.2
2323
- isort@5.13.2
2424
- perltidy
25-
- ruff@0.4.8
25+
- ruff@0.5.3
2626
- actionlint@1.7.1
2727
- hadolint@2.12.0
28-
- checkov@3.2.133
28+
- checkov@3.2.194
2929
- git-diff-check
3030
- markdownlint@0.41.0
31-
- prettier@3.3.2
31+
- prettier@3.3.3
3232
- shellcheck@0.10.0
3333
- shfmt@3.6.0
34-
- trivy@0.52.1
35-
- trufflehog@3.78.0
34+
- trivy@0.53.0
35+
- trufflehog@3.80.1
3636
- yamllint@1.35.1
3737
ignore:
3838
- linters: [ALL]

0 commit comments

Comments
 (0)