add-and-commit icon indicating copy to clipboard operation
add-and-commit copied to clipboard

Is there a way to know if the push actually happened?

Open aqeelat opened this issue 3 years ago • 3 comments

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.

aqeelat avatar Aug 02 '22 13:08 aqeelat

Yup, you can use the pushed output. More info about this action's outputs here

EndBug avatar Aug 02 '22 14:08 EndBug

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

aqeelat avatar Aug 02 '22 14:08 aqeelat

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 :)

EndBug avatar Aug 02 '22 15:08 EndBug

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.

github-actions[bot] avatar Aug 29 '22 19:08 github-actions[bot]