diff --git a/.github/workflows/merge.yaml b/.github/workflows/merge.yaml index 805bdd9..4ce5322 100644 --- a/.github/workflows/merge.yaml +++ b/.github/workflows/merge.yaml @@ -4,9 +4,51 @@ 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: if: |- github.event.pull_request.user.login == 'dependabot[bot]' || diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5663a13..953097c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,6 +28,10 @@ rev: 3.12.0 hooks: - id: commitizen + - repo: https://github.com/koalaman/shellcheck-precommit + rev: v0.9.0 + hooks: + - id: shellcheck - repo: https://github.com/pre-commit/mirrors-clang-format rev: v17.0.6 hooks: