ci(pre-commit): pre-commit autoupdate #9
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
name: Merge | |
on: | |
pull_request: | |
permissions: | |
contents: write | |
pull-requests: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check | |
run: | | |
function checks() { | |
(gh pr checks "${{ github.event.pull_request.html_url }}" || true) | | |
grep --invert-match "${{ github.run_id }}" | |
} | |
function count() { | |
checks | | |
cut --fields=2 | | |
(grep --count "$@" || true) | |
} | |
while true; do | |
pending=$(count pending) | |
if ((pending > 0)); then | |
echo "Waiting for $pending checks to complete..." | |
sleep 10 | |
else | |
break | |
fi | |
done | |
fail=$(count fail) | |
if ((fail > 0)); then | |
echo "$fail checks failed" | |
exit 1 | |
else | |
echo "All checks passed" | |
exit 0 | |
fi | |
env: | |
GH_TOKEN: ${{ github.token }} | |
merge: | |
name: Merge | |
if: github.event.pull_request.user.login == 'dependabot[bot]' || | |
github.event.pull_request.user.login == 'pre-commit-ci[bot]' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Enable auto-merge | |
run: gh pr merge ${{ github.event.pull_request.html_url }} --auto --squash | |
env: | |
GH_TOKEN: ${{ github.token }} |