generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 3
38 lines (38 loc) · 1.21 KB
/
pre-commit.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: pre-commit
on: [push]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: actions/cache@v4
with:
path: |
~/.cache/R/renv
key: r-precommit-cache|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit
uses: pre-commit/[email protected]
- 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.ZS_PAT }}
branch: ${{ github.ref }}
env:
RENV_CONFIG_CACHE_ENABLED: FALSE
RENV_WATCHDOG_ENABLED: FALSE