Skip to content

Commit

Permalink
Automatically merge dependabot PRs (#205)
Browse files Browse the repository at this point in the history
* Automatically merge dependabot PRs

* Make ubcsailbotsoftware a code owner
  • Loading branch information
patrick-5546 authored Nov 11, 2023
1 parent f24bf21 commit c0bce0a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# the repo. Unless a later match takes precedence,
# these owners will be requested for
# review when someone opens a pull request.
* @patrick-5546
* @ubcsailbotsoftware @patrick-5546
23 changes: 23 additions & 0 deletions .github/workflows/test_definitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ on:
PAT_TOKEN:
required: false

permissions:
contents: write
pull-requests: write

jobs:
# Adapted from https://github.com/actions/toolkit/issues/1264#issuecomment-1770928498
extract-metadata:
Expand Down Expand Up @@ -192,3 +196,22 @@ jobs:
gh run watch --exit-status -R UBCSailbot/sailbot_workspace $(gh run list -R UBCSailbot/sailbot_workspace -w tests.yml -L1 --json databaseId --jq '.[0].databaseId')
env:
GH_TOKEN: ${{ secrets.PAT_TOKEN }}

# Merges Dependabot PRs
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions
merge-dependabot-pr:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Fetch metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.PAT_TOKEN }}"
- name: Enable auto-merge and approve PR
run: |
gh pr merge --auto --merge "$PR_URL"
gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.PAT_TOKEN}}

0 comments on commit c0bce0a

Please sign in to comment.