Skip to content

Ability to skip pre-commit on specific commits or PRs #28

@nitrocode

Description

@nitrocode

Have a question? Please checkout our Slack Community or visit our Slack Archive.

Slack Community

Describe the Feature

It would be nice to skip the pre-commit for a PR, perhaps using a PR label
It would be nice to skip the pre-commit for a commit message, perhaps using skip ci or similar

There is no way to use a native way in pre-commit to skip hooks on a specific commit message such as using skip ci. See pre-commit/pre-commit#2806.

Expected Behavior

An easy way to skip pre-commit per commit or per PR.

Usually this comes up if there is a special edge case where you need something done without one of pre-commit's hooks getting in the way, without disabling the entire hook all together.

Use Case

We have some old code where a hook is updating the code and is doing it with the new way instead of the old way. We can work on upgrading the code or fixing the hook. We'd prefer punting for now to get the changes out and creating a ticket in the next sprint to fix the underlying issue.

Describe Ideal Solution

    - uses: cloudposse/github-action-pre-commit@v2.1.2
      with:
        skip-pr-label: 'skip-precommit' # Hypothetically this is the default value

Alternatives Considered

One alternative is to bake an if condition before the action is called

    - uses: cloudposse/github-action-pre-commit@v2.1.2
      if: contains(github.event.pull_request.labels.*.name, 'skip-precommit')

Additional Context

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions