Closed lewispb closed 4 years ago
I think that'd be nice.
Thanks for this @lewispb, initially sounds like a good idea!
Just had a couple of thoughts, one perhaps falls in the https://xkcd.com/1172/ camp so we can discuss 😅, but the other probably needs to be checked up on?
I have a shortcut for git commit -a --amend --no-edit && git push -f
:
$ cp8_cli[master] » cp8 start "new story"
# write code
# write code
$ cp8_cli[jb/new_story] » gfup
# write code
$ cp8_cli[jb/new_story] » gfup
$ cp8_cli[jb/new_story] » cp8 open # done
$ cp8_cli[master] »
# write code
# write code
$ cp8_cli[master] » git add .
$ cp8_cli[master] » cp8 start "new story"
$ cp8_cli[jb/new_story] » cp8 open # done
For both of these scenarios, I guess this would mean an additional step of editing the commit message in order to kick the CI into gear?
[skip ci]
commit on a branch/PR, would never pick up the CI again...even for subsequent commits! Not sure if that is still the case though. 🤔
Thanks for looking at this @balvig !
That's a good point you raise, I also use initial commits in different ways.
Maybe what I'm really getting at is I don't want an empty commit to trigger a CI run.
I've actually come at this from a different angle now and whipped up a little prepare-commit-msg
git hook instead:
if [ -z "$(git diff --cached --name-status -r)" ]
then
echo "$(cat $1)\n\n[skip ci]" > $1
fi
So this will add [skip ci]
to any empty commit, not just those from cp8_cli.
In regards to your second point reading this (Note: If you push multiple commits at once, a single [ci skip] or [skip ci] will skip the build for all commits.
) I got the impression future commits would be OK, but I could be wrong and will need to test this further.
We could add something like the above logic (if commit is empty, add [skip ci]
) to cp8_cli
, if not then I'm happy to close this as I have a good solution just for me now with the git hook.
Maybe what I'm really getting at is I don't want an empty commit to trigger a CI run.
That was the conclusion I was arriving at as well...makes sense.
I think I will try out that prepare-commit-msg
for a while, looks neat!
If it works well, might indeed be useful to include in cp8
.
Thanks again @lewispb!
I'd like it so that CircleCI is not triggered on the initial commit / empty PR, as per this guide:
https://circleci.com/docs/2.0/skip-build/
The format of the commit message (double -m args) is inspired by this post: https://stackoverflow.com/a/22909204
What do you think? 😄