Skip to content

Commit

Permalink
🤖 Auto approve dep bump and provider release PRs (#4958)
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Zunker <[email protected]>
  • Loading branch information
czunker authored Dec 5, 2024
1 parent 2435566 commit 2c1e4e9
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/pr-test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ jobs:
# For now, we only auto approve and merge provider release PRs created by mondoo-tools.
# We have to check the commit author, because the PR is created by "github-actions[bot]"
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions#startswith
if: ${{ startsWith(github.ref, 'refs/heads/version/providers_update_') && github.event.commits[0].author.username == 'mondoo-tools' }}
if: ${{ (startsWith(github.ref, 'refs/heads/version/providers_update_') || startsWith(github.ref, 'refs/heads/version/deps_update_')) && github.event.commits[0].author.username == 'mondoo-tools' }}
permissions:
contents: write
pull-requests: write
Expand All @@ -191,10 +191,20 @@ jobs:
github-token: "${{ secrets.GITHUB_TOKEN }}"
filterOutClosed: true
filterOutDraft: true
- name: Approve a PR
uses: fastify/github-action-merge-dependabot@v3
# fetch a token for the mondoo-mergebot app
- name: Generate token
id: generate-token
uses: actions/create-github-app-token@v1
with:
pr-number: ${{ steps.pr.outputs.number }}
app-id: ${{ secrets.MONDOO_MERGEBOT_APP_ID }}
private-key: ${{ secrets.MONDOO_MERGEBOT_APP_PRIVATE_KEY }}
# automerge using bot token
- name: Approve and merge a PR
run: |
gh pr review ${{ steps.pr.outputs.number }} --approve
gh pr merge ${{ steps.pr.outputs.number }} --squash
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}

event_file:
name: "Store event file"
Expand Down

0 comments on commit 2c1e4e9

Please sign in to comment.