Skip to content

Commit

Permalink
Fix dependabot PR auto-merge action
Browse files Browse the repository at this point in the history
  • Loading branch information
ylabonte committed Mar 15, 2024
1 parent 50009a7 commit 49e8e0b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 24 deletions.
28 changes: 11 additions & 17 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
name: "Auto-Merge Dependabot PRs"

on:
workflow_run:
workflows:
- "CI Workflow"
types:
- completed
on: [ pull_request ]

permissions:
contents: write
pull-requests: write

jobs:
ci:
name: "Run CI Workflow"
uses: ./.github/workflows/ci.yml
codeql:
name: "Run CodeQL Workflow"
uses: ./.github/workflows/codeql.yml
automerge:
name: "Auto-merge Dependabot PR"
name: "Auto-merge PR (Dependabot only!)"
needs:
- ci
- codeql
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: "Fetch Dependabot metadata"
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: "Approve the PR"
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: "Auto-merge the PRs"
run: gh pr merge --auto --merge "$PR_URL"
env:
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ on:
- "master"
- "develop"
- "feature/*"
pull_request:
branches:
- "master"
- "develop"
- "feature/*"
workflow_call:

jobs:
build:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ name: "CodeQL"
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: '43 0 * * 2'
workflow_call:

jobs:
analyze:
Expand Down

0 comments on commit 49e8e0b

Please sign in to comment.