Merge pull request #158 from rollingrock/v78 #14
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: maintenance | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| maintenance: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout pull request branch | |
| if: github.event_name == 'pull_request' | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| - name: Checkout | |
| if: github.event_name != 'pull_request' | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| - name: Install pre-commit | |
| run: python -m pip install pre-commit | |
| # Same-repo branches (push / non-fork PR): auto-fix and commit back. | |
| - name: Run pre-commit | |
| if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository | |
| continue-on-error: true | |
| run: pre-commit run --all-files --show-diff-on-failure | |
| - name: Commit maintenance fixes | |
| if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| with: | |
| commit_message: "chore: maintenance" | |
| - name: Verify pre-commit | |
| if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository | |
| run: pre-commit run --all-files --show-diff-on-failure | |
| # Fork PRs are read-only: check and fail with diffs, never push back. | |
| - name: Run pre-commit for external pull requests | |
| if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository | |
| run: pre-commit run --all-files --show-diff-on-failure |