Skip to content

Commit

Permalink
ci(dependabot): auto merge pull requests
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbasham committed Jan 17, 2024
1 parent a320cea commit a0094a7
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
interval: weekly
commit-message:
prefix: ci(deps)
- package-ecosystem: gomod
directory: /
schedule:
interval: weekly
interval: monthly
commit-message:
prefix: chore(deps)
ignore:
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/auto-merge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: auto-merge
on:
pull_request:
permissions:
contents: write
pull-requests: write
jobs:
dependabot:
if: github.triggering_actor == 'dependabot[bot]'
name: Auto merge pull requests
runs-on: ubuntu-latest
steps:
- uses: dependabot/[email protected]
id: dependabot-metadata
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Approve Dependabot PR
run: gh pr review --approve "${PR_URL}"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
# Because we enforce PRs be approved by a code owner, a token from the
# operations team must be used to approve the PR. This token is from the
# StatusCake machine account which has been given membership to the
# operations team.
GITHUB_TOKEN: ${{ secrets.MACHINE_TOKEN }}
- if: |
steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' ||
contains(github.event.pull_request.labels.*.name, 'github_actions')
name: Enable auto-merge for Dependabot PR
run: gh pr merge --auto --merge "${PR_URL}"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 15 additions & 0 deletions .yamlfmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# vi: ft=yaml
---
formatter:
type: basic
# There is a "bug" with the behaviour of this option that will move file head
# comments below the initial document start. For example front matter is
# rearraged and therefore misplaced in the file. This behaviour prevents
# `ymalfmt` from being run in CI or automatically in code editors.
include_document_start: true
indentless_arrays: true
pad_line_comments: 2
# There is missing functionality in `yamlfmt` to remove redundantly quoted
# strings from YAML documents, and prefer the use of double quotes (or
# whatever is configured). This means further manual effort is required to
# correct files.
2 changes: 2 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
---
extends: default
rules:
document-start:
level: error
indentation:
indent-sequences: false
spaces: 2
Expand Down

0 comments on commit a0094a7

Please sign in to comment.