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

feat: run the hook only if CircleCI config file is changed #3

Merged
merged 1 commit into from
Oct 15, 2021
Merged

feat: run the hook only if CircleCI config file is changed #3

merged 1 commit into from
Oct 15, 2021

Conversation

YaraslauZhylko
Copy link
Contributor

@YaraslauZhylko YaraslauZhylko commented Oct 15, 2021

As of now, the hook is run every time git commit is attempted. And validating CircleCI config takes quite a bit of time as compared to other pre-commit linters out there.

And as we are targeting one specific file only, we should only run the hook if that particular file is staged and is going to be committed. And skip running it otherwise.

$ git status
On branch feat/change-ci-config
Your branch is up to date with 'origin/feat/change-ci-config'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   .circleci/config.yml

$ git commit
Validate CircleCI config.................................................Passed
$ git status
On branch feat/change-something-else
Your branch is up to date with 'origin/feat/change-something-else'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   src/main.py

$ git commit
Validate CircleCI config.............................(no files to check)Skipped

P.S.: pre-commit run --all-files will still run all the hooks.

@zahorniak
Copy link
Owner

@YaraslauZhylko great suggestion!

@zahorniak zahorniak merged commit 7be19ef into zahorniak:master Oct 15, 2021
@zahorniak
Copy link
Owner

@YaraslauZhylko new version has been released v0.3

@YaraslauZhylko YaraslauZhylko deleted the feat/run-on-config-changes-only branch October 15, 2021 13:31
github-actions bot pushed a commit that referenced this pull request May 29, 2024
## 1.0.0 (2024-05-29)

### Features

* Add support for multiple config files ([#9](#9)) ([8e09e3b](8e09e3b)), closes [#8](#8)
* run the hook only if CircleCI config file is changed ([#3](#3)) ([7be19ef](7be19ef))
Copy link

This PR is included in version 1.0.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants