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

ci: do not triggers some gh actions for pre-commit-ci-update-config branch #186

Merged
merged 10 commits into from
Jul 28, 2021

Conversation

oboulant
Copy link
Collaborator

The situation :

As of today, for the PRs automatically generated by pre-commit-ci from branch pre-commit-ci-update-config to master and only affecting .pre-commit-config.yaml, run all the CI tests like any other PRs.

What we do :

When only .pre-commit-config.yaml is affected by the PR, then the following Gh Actions are not run :

  • .github/workflows/check-docs.yml
  • .github/workflows/run-test-coverage.yml
  • .github/workflows/run-test.yml

@github-actions github-actions bot added the Type: CI Changes to CI configuration files and scripts label Jul 22, 2021
@codecov
Copy link

codecov bot commented Jul 22, 2021

Codecov Report

Merging #186 (fa42cb0) into master (d211c5c) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #186   +/-   ##
=======================================
  Coverage   96.31%   96.31%           
=======================================
  Files          40       40           
  Lines         978      978           
=======================================
  Hits          942      942           
  Misses         36       36           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d211c5c...fa42cb0. Read the comment docs.

@oboulant
Copy link
Collaborator Author

As can be seen in the commits, I tested several approaches :

  • skip the job steps if github.event.label.name != 'skip-changelog'

This solution does not work because we do not have the guarantee that the PR is labelled before the jobs are started....
Moreover, the jobs are started regardless of the conditions, it is just that if the condition is met, then we skip the following steps

  • skip job steps if the name of the PR is pre-commit autoupdate

Might work but still, the jobs are started, it is just that the steps after the condition are ignored

  • [Final implementation]

If the PR only modifies .pre-commit-config.yaml, then jobs are ignored.

@deepcharles
Copy link
Owner

Does it work now? I am a bit lost

@oboulant
Copy link
Collaborator Author

Does it work now? I am a bit lost

Yes it does. I try to explain everything I tried in this comment from the current PR.

Bottom line, yes the PR is ready. And basically what it does is the following : for any newly created PR, if the PR consists only in a modification in .pre-commit-config.yaml, then we do not run the workflows I mentioned.

By doing so, we can for instance avoid running tests for the automatically created PR from pre-commit-ci.

Let me know if unclear !

@deepcharles
Copy link
Owner

Oh ok cool.

Copy link
Owner

@deepcharles deepcharles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect

@oboulant oboulant merged commit ed967de into master Jul 28, 2021
@oboulant oboulant deleted the ignore-precommit-path-ci branch July 28, 2021 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: CI Changes to CI configuration files and scripts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants