add-and-commit
add-and-commit copied to clipboard
Is there a way to know if the push actually happened?
If no files were updated, the commit would be empty and the push will say "Everything up-to-date". Is there a way to capture that via step output?
For example, we have a workflow that lints the code then runs the test. If the files were updated during the lint, we would push the changes and that would trigger another workflow run. However, I would like to exit the job early to not waste runner credits.
Yup, you can use the pushed output. More info about this action's outputs here
Wouldn't the pushed output return True if there was no failure? Pushing while up-to-date returns a 0 exit code. I tried to dig into the docs for simplegit but I couldn't reach a conclusive answer
No, the outputs reflect what actually happened. To get their value I'm using simple-git's callbacks, along with some additional logic for some of them. They're not just parsed from exit codes. If you try to run the action and use its output you'll see that when there are no changes your outputs will be like this:
committed: false
commit_long_sha: undefined
commit_sha: undefined
pushed: false
tagged: false
tag_pushed: false
If you want to see how it's actually done you can look at the source code but, unless there's any bug, the docs are up-to-date Let me know if this solves your issue :)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.