Skip to content

Dependabot auto-close on fail #12182

Dependabot auto-close on fail

Dependabot auto-close on fail #12182

Workflow file for this run

name: Dependabot auto-close on fail
on:
check_run:
types: [completed] # runs whenever a github check action completes
# Gotta be able to operate on PRs
permissions:
pull-requests: write
contents: write
jobs:
close:
runs-on: ubuntu-latest
# If the check is called 'build' and it failed and the PR is from either dependabot or renovate
# See https://docs.github.com/en/actions/learn-github-actions/expressions for docs on this language.
if: ${{ github.event.check_run.conclusion == 'failure' && github.event.check_run.name == 'build' && (startsWith(github.event.check_run.pull_requests[0].head.ref, 'renovate/') || startsWith(github.event.check_run.pull_requests[0].head.ref, 'dependabot/')) }}
steps:
- name: Close pr
# Then close the PR and comment
run: gh pr close -d -R webcomponents/custom-elements-everywhere "$PR_NUM" && gh pr comment -R webcomponents/custom-elements-everywhere "$PR_NUM" -b "Auto-closing because it breaks tests"
env:
PR_NUM: ${{github.event.check_run.check_suite.pull_requests[0].number}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}