Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Use GH cli to merge approved PR #1482

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions .github/workflows/pr-test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,15 @@ jobs:
name: test-results
path: report.xml

go-auto-approve:
go-auto-approve-dependabot:
runs-on: ubuntu-latest
needs: [go-test, go-bench, golangci-lint, go-mod]
# For now, we auto approve and merge:
# - go dep PRs
# - cnquery update PRs
# because we have tests for this in place.
# 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/dependabot/go_modules') && github.actor == 'dependabot[bot]') ||
(startsWith(github.ref, 'refs/heads/version/cnquery_update_v') && github.event.commits[0].author.username == 'mondoo-tools')
if: startsWith(github.ref, 'refs/heads/dependabot/go_modules') && github.actor == 'dependabot[bot]'
permissions:
contents: write
pull-requests: write
Expand All @@ -115,6 +113,33 @@ jobs:
with:
pr-number: ${{ steps.pr.outputs.number }}

go-auto-approve-mondoo:
runs-on: ubuntu-latest
needs: [go-test, go-bench, golangci-lint, go-mod]
# For now, we auto approve and merge:
# - go dep PRs
# - cnquery update PRs
# because we have tests for this in place.
# 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/cnquery_update_v') && github.event.commits[0].author.username == '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 and merge a PR
run: |
gh pr review ${{ steps.pr.outputs.number }} --approve
gh pr merge ${{ steps.pr.outputs.number }} --squash --merge
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

event_file:
name: "Store event file"
runs-on: ubuntu-latest
Expand Down
Loading