-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Use GH cli to merge approved PR (#1482)
Signed-off-by: Christian Zunker <[email protected]>
- Loading branch information
Showing
1 changed file
with
29 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 | ||
|