pre-commit-ci / issues

public issues for https://pre-commit.ci
17 stars 3 forks source link

Honor [skip ci] #31

Closed Cielquan closed 3 years ago

Cielquan commented 3 years ago

I don't know how far the git repo is inspected or even if at all, but it could save some runs, if [skip ci] would be honored when inside the commit message subject.

Or is the expense to always check for this higher than the actual saving? On the other hand would this be a nice feature regardless.

asottile commented 3 years ago

yeah I think I can do this without any overhead -- I'll probably do both [skip ci] and [skip pre-commit.ci]

asottile commented 3 years ago

hmmm actually for the pull request events we don't get any information about the commit message -- only for the push events

would you want this for pull requests or for pushes? for push requests would it go off of the pull request title?

how do others implement this?

Cielquan commented 3 years ago

how do others implement this?

I do not have much experience with CI in general. I used azure pipelines a short time and now github actions (GHA) which does not support this feature out of the box: https://github.com/actions/runner/issues/774 but there are workarounds.

In this post someone put links to docs of multiple CI provider which support it: https://github.community/t/github-actions-does-not-respect-skip-ci/17325/3


hmmm actually for the pull request events we don't get any information about the commit message -- only for the push events

would you want this for pull requests or for pushes? for push requests would it go off of the pull request title?

I currently add this line to my GHA workflows:

    if: github.event_name == 'pull_request' || (github.event_name == 'push' && contains(toJson(github.event.commits), '[skip ci]') == false)

so only pushes are checked for [skip ci]. When I remember correctly I read in one of the above links or some other post (regarding GHA), that this check only works for pushes anyway. But my "philosophy" matches that, as I want my PR-commits to be always checked, because I set required checks for PR-merges and that too cases problems when you run e.g. tests for docs only when doc-files change: https://github.com/actions/virtual-environments/issues/1281. Currently I use the [skip ci] for the commits from my release pipeline so that they do not get checked when pushed to master.

asottile commented 3 years ago

I guess the first-pass implementation of this can be for pushes and if someone else asks for PRs later then that can be implemented

asottile commented 3 years ago

alrighty this should be live for pushes! note that this will only apply on pushes to the main branch given the complication with pull requests

Cielquan commented 3 years ago

Nice! Thanks for the fast implementation. Works perfectly 👍🏾

pokey commented 1 year ago

would it be hard to add this for PRs? I could use that feature right now

asottile commented 1 year ago

it doesn't really make sense for PRs