Random landmarking #63
Workflow file for this run
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: pre-commit | |
| on: | |
| push: | |
| branches-ignore: | |
| - 'master' | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| pre-commit: | |
| runs-on: ubuntu-latest | |
| if: >- | |
| !endsWith(github.event.head_commit.message, '# ci skip') && | |
| ( | |
| startsWith(github.ref, 'refs/heads') || | |
| github.event.pull_request.draft == false | |
| ) | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Cache pre-commit | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pre-commit | |
| key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}- | |
| - name: Run pre-commit | |
| id: precommit | |
| uses: pre-commit/[email protected] | |
| continue-on-error: true | |
| - name: Commit files | |
| if: steps.precommit.outcome == 'failure' && startsWith(github.ref, 'refs/heads') | |
| run: | | |
| if [[ `git status --porcelain --untracked-files=no` ]]; then | |
| git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add . | |
| git checkout -- .github/workflows | |
| git commit -m "pre-commit" -a | |
| fi | |
| shell: bash -ex {0} | |
| - name: Push changes | |
| if: steps.precommit.outcome == 'failure' && startsWith(github.ref, 'refs/heads') | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ github.ref }} | |
| - name: Check pre-commit | |
| if: steps.precommit.outcome == 'failure' | |
| uses: pre-commit/[email protected] |