Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch up with pre-commit.ci lite #523

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 9 additions & 28 deletions inst/pre-commit-gha.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
name: pre-commit
on:
push:
branches-ignore:
branches:
- 'master'
- 'main'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

jobs:
pre-commit:
runs-on: ubuntu-18.04
if: >-
!contains(github.event.head_commit.message, 'ci skip') &&
(
startsWith(github.ref, 'refs/heads') ||
github.event.pull_request.draft == false
)
main:
runs-on: ubuntu-latest
if: !contains(github.event.head_commit.message, 'ci skip')
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
Expand All @@ -25,31 +19,18 @@ jobs:
with:
fetch-depth: 0
- name: Install system dependencies
if: runner.os == 'Linux'
run: |
# your system installation code here
# sudo apt-get install -y libcurl4-openssl-dev
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "3.11"
architecture: "x64"
- name: Run pre-commit
uses: pre-commit/action@v2.0.3
- 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 }}
uses: pre-commit/action@v3.0.0
- uses: pre-commit-ci/lite-action@v1.0.1
if: always()

env:
RENV_CONFIG_CACHE_ENABLED: FALSE
8 changes: 0 additions & 8 deletions vignettes/ci.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,6 @@ options.

**Cons:**

- out-of-the-box action is in [maintenance only
mode](https://github.com/pre-commit/action) and less feature
complete than [pre-commit.ci](https://pre-commit.ci). For example,
if your hooks fail on first attempt, the corrections are committed
and pushed, but they won't trigger a new CI and you can't make them
do it without [exposing
credentials](https://github.com/pre-commit/action/pull/49). The only
way is to close and re-open the PR.
- No configuration options such as hook skipping supported that
[pre-commit.ci](https://pre-commit.ci) supports.
- You need to maintain the workflow file with a lot of boilerplate
Expand Down