ci: bump remaining GitHub Actions majors and drop issues-helper #12313
This file contains hidden or 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: black-linter | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - '**/*.py' | |
| - requirements.txt | |
| - .github/workflows/black-lint.yml | |
| pull_request: | |
| paths: | |
| - '**/*.py' | |
| - requirements.txt | |
| - .github/workflows/black-lint.yml | |
| concurrency: | |
| group: ${{ github.workflow }} - ${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v7 | |
| with: | |
| python-version: '3.x' | |
| - name: Install black | |
| run: | | |
| set -euo pipefail | |
| pin="$(grep '^black==' requirements.txt || true)" | |
| if [ -z "$pin" ]; then | |
| echo "requirements.txt must contain a black== version pin." | |
| exit 1 | |
| fi | |
| python -m pip install "$pin" | |
| - name: Check black | |
| run: | | |
| set -euo pipefail | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| mapfile -t files < <(git diff --name-only --diff-filter=ACMR "${{ github.event.pull_request.base.sha }}" -- '*.py' || true) | |
| else | |
| before="${{ github.event.before }}" | |
| if [ -z "$before" ] || [[ "$before" =~ ^0+$ ]]; then | |
| echo "No previous commit; skip black." | |
| exit 0 | |
| fi | |
| mapfile -t files < <(git diff --name-only --diff-filter=ACMR "$before" "${{ github.sha }}" -- '*.py' || true) | |
| fi | |
| if [ ${#files[@]} -eq 0 ]; then | |
| echo "No Python files changed." | |
| exit 0 | |
| fi | |
| python -m black -S --check "${files[@]}" |