fix: support no changes#67
Conversation
|
I'll need to investigate why it's failing to run the tests. This is happening on #66 as well. So I don't believe it's localized to your branch. |
abannachGrafana
left a comment
There was a problem hiding this comment.
Please add optional input of succeed-if-no-changes with a default of false to control the exit code. This will preserve existing functionality while supporting an option where no changes committed is ok in a workflow where that's ok.
Thank you @abannachGrafana. Rebased but the workflows need to be approved. |
Thank you for reviewing @abannachGrafana . My idea comes from using the git CLI and the stefanzweifel/git-auto-commit-action action which don't fail if there are no changes.
Aside from my proposal being a breaking change, I'd think that detecting if there were changes in the working dir can be done with a separate step like I understand your suggestion of compatibility and we can still go with Before proceeding with the change, what do you think? |
|
Re: the workflow runs Thanks! The other PR dev also did so and we still have a failure due to repo permissions. I'm in progress on a fix for that, but am waiting on a request to go through.
Correct as a git user in the terminal you would realize the error and could correct it if there were no changes staged. Since github actions are an automated workflow with no way to intervene I still believe the action should fail by default if the implementor forgot or failed to change files when its expected that there should be a change. Consider something like an "Update changelog" workflow that is supposed to add PR info to the changelog. If the changelog wasn't changed or the workflow creator forgot to stage the file in a step. They may think everything is fine if the commit step was successful.
Yes! I'd pose that this should be done prior and to skip calling the commit step all together with a conditional on the step. I'd also think that if a workflow may or may not make changes, it'd be better structured in that way as well so that it's clear it's possible that nothing is committed. I'd like to stick with the |
|
Got it. Thank you for the explanation @abannachGrafana . I added The |
|
Yeah, I'm fighting with the tests because the generated GITHUB_TOKEN doesn't have write permission with event type of |
abannachGrafana
left a comment
There was a problem hiding this comment.
Looking great. The tests make sense too. Just a few suggestions
|
you'll wanna pull from main again too |
Co-authored-by: Adam Bannach <113929542+abannachGrafana@users.noreply.github.com>
|
Thanks. Applied the suggestions. |
|
thanks @gmeligio ! |
|
Hey @abannachGrafana, could you please release this? |
|
@gmeligio New release |
|
Thank you! I got it today with renovate. I'll take what you mentioned into account for next time. |
Currently, if a working directory has no changes, the step will finish with a failure. This is unexpected since nothing wrong happened, and it's just that there is no need to make a commit. That no-changes can be handled by not running the making the Github API request. In that case, there would be no
commit-reponse.Note: I haven't run the Github workflows for testing yet. It looks like they should be approved on this PR before running.