From 85a64708c6d23625a5266a0899f2b655c57e7881 Mon Sep 17 00:00:00 2001 From: Christian Zunker <827818+czunker@users.noreply.github.com> Date: Mon, 18 Nov 2024 17:22:36 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Use=20GH=20cli=20to=20merge=20ap?= =?UTF-8?q?proved=20PR=20(#1482)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian Zunker --- .github/workflows/pr-test-lint.yml | 33 ++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-test-lint.yml b/.github/workflows/pr-test-lint.yml index 1804d6f3..0fb942c7 100644 --- a/.github/workflows/pr-test-lint.yml +++ b/.github/workflows/pr-test-lint.yml @@ -88,7 +88,7 @@ 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: @@ -96,9 +96,7 @@ jobs: # - 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/get-pr@v2.0.0 + 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