Skip to content

Commit

Permalink
🤖 Auto approve cnspec bump PRs
Browse files Browse the repository at this point in the history
When we auto approve these, this will automatically trigger the release workflow.
This will allow us to create a packer-plugin release each time we create a new cnspec release.

Signed-off-by: Christian Zunker <[email protected]>
  • Loading branch information
czunker committed Nov 11, 2024
1 parent 437f486 commit 6729691
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/pr-test-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,35 @@ jobs:
env:
API_VERSION: x5.0
CNSPEC_VERSION: ${{ env.CNSPEC_VERSION }}

debug:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: |
echo "$GITHUB_CONTEXT"
go-auto-approve:
runs-on: ubuntu-latest
needs: [goreleaser, license-check]
# For now, we only auto approve and merge cnspec bump 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/cnspec_update_v') && github.event.commits[0].author.name == 'mondoo-tools' }}
permissions:
contents: write
pull-requests: write
steps:
# figure out the PR for this commit
- uses: cloudposse-github-actions/[email protected]
id: pr
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
filterOutClosed: true
filterOutDraft: true
- name: Approve a PR
uses: fastify/github-action-merge-dependabot@v3
with:
pr-number: ${{ steps.pr.outputs.number }}

0 comments on commit 6729691

Please sign in to comment.