Skip to content

Commit

Permalink
🧹 Debug dependabot auto-approve PRs (#1416)
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Zunker <christian@mondoo.com>
  • Loading branch information
czunker authored Sep 4, 2024
1 parent b3e8840 commit b7b9a6b
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions .github/workflows/pr-test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,19 @@ jobs:
name: test-results
path: report.xml

debug:
runs-on: ubuntu-latest
needs: go-test
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"

go-auto-approve:
runs-on: ubuntu-latest
needs: go-test
if: ${{ github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' && needs.go-test.outputs.outcome == 'success' }}
if: ${{ github.actor == 'dependabot[bot]' && needs.go-test.outputs.outcome == 'success' }}
permissions:
contents: write
pull-requests: write
Expand All @@ -101,15 +110,17 @@ jobs:
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve a PR
# For now, we only auto approve and merge go dep PRs because we have tests for this in place.
if: ${{ steps.dependabot-metadata.outputs.package-ecosystem == 'go' }}
# Settings the comment will auto merge the PR after all tests passed
# https://docs.github.com/en/enterprise-cloud@latest/code-security/dependabot/working-with-dependabot/managing-pull-requests-for-dependency-updates#managing-dependabot-pull-requests-with-comment-commands
run: gh pr review --comment "@dependabot squash and merge" --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Debug metadata
run: echo "${{ steps.metadata.outputs }}"
# - name: Approve a PR
# # For now, we only auto approve and merge go dep PRs because we have tests for this in place.
# if: ${{ steps.dependabot-metadata.outputs.package-ecosystem == 'go' }}
# # Settings the comment will auto merge the PR after all tests passed
# # https://docs.github.com/en/enterprise-cloud@latest/code-security/dependabot/working-with-dependabot/managing-pull-requests-for-dependency-updates#managing-dependabot-pull-requests-with-comment-commands
# run: gh pr review --comment "@dependabot squash and merge" --approve "$PR_URL"
# env:
# PR_URL: ${{github.event.pull_request.html_url}}
# GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

event_file:
name: "Store event file"
Expand Down

0 comments on commit b7b9a6b

Please sign in to comment.