Merge branch 'main' into strict-examples #1489
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: pre-commit | |
on: | |
push: | |
branches-ignore: | |
- "master" | |
- "main" | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
if: >- | |
!contains(github.event.head_commit.message, 'ci skip') && | |
( | |
startsWith(github.ref, 'refs/heads') || | |
github.event.pull_request.draft == false | |
) | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: "3.9" | |
architecture: "x64" | |
- name: Run pre-commit | |
uses: pre-commit/[email protected] | |
env: | |
SKIP: pkgdown | |
- name: Commit files | |
if: failure() && startsWith(github.ref, 'refs/heads') | |
run: | | |
if [[ `git status --porcelain --untracked-files=no` ]]; then | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git checkout -- .github/workflows | |
git commit -m "pre-commit" -a | |
fi | |
- name: Push changes | |
if: failure() && startsWith(github.ref, 'refs/heads') | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
env: | |
RENV_CONFIG_CACHE_ENABLED: FALSE | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |