-
Notifications
You must be signed in to change notification settings - Fork 255
Add commit hash output to GitHub Action #717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I can try and take a look at this. This should be done in https://github.com/python-semantic-release/python-semantic-release/blob/master/semantic_release/cli/github_actions_output.py vs. the shell entrypoint, right? @codejedi365 do you have a preference for the name the hash shows up as? (side note: one quirk I've found recently is that while the node semantic-release cuts releases with |
Great! Yes, I think you can just extend the code that auto writes the variable file. That file is the object class where it is defined and modified (unfortunately not in the most standard way) inside of
That is a way to get the value but be aware it does perform git actions under the hood, no real preference on the name. You will need to consider probably a tag sha as well, as we do support
The default |
It has been 60 days since the last update on this confirmed issue. @python-semantic-release/team can you provide an update on the status of this issue? |
Still in backlog |
It has been 60 days since the last update on this confirmed issue. @python-semantic-release/team can you provide an update on the status of this issue? |
Still in backlog |
It has been 60 days since the last update on this confirmed issue. @python-semantic-release/team can you provide an update on the status of this issue? |
Still in backlog |
It has been 60 days since the last update on this confirmed issue. @python-semantic-release/team can you provide an update on the status of this issue? |
Uh oh!
There was an error while loading. Please reload this page.
Description
Hi,
The issue is related to another popular GitHub Action
actions/checkout
which allows to checkout the repository. Unfortunately, when checking out the repository that triggered a workflow, this defaults to the reference or SHA for that event. This means, that the subsequent jobs in the workflow will not include the updates made with PSR action.For example if we have a workflow with 3 jobs, the first to run PSR and release package to GitHub, the second job to build and release image to Docker Hub(the image should include updated package with changelog changes, new version file, etc from the job 1), and the third job to build and release package to PyPI(the built package should also include all of the updates from the job 1).
Here is an example of this workflow(with some non-important steps amended):
The way GitHub actions works, the pypi and docker jobs will not include the commits made by release job. A simple
git pull
to HEAD reference, will pull those commits; However, such solution can also introduce a race condition, in case there were other commits made while therelease
job was running. More Info about this issue.The correct solution would be for PSR GitHub Action to output the hash of the commit that has been made, which can be used in other jobs to pull the updates.
Use cases
Using separate jobs for updating version/releasing packages.
Possible implementation
Well, adding outputs would be easy(I assume), but I'm not sure how to get the commit hash after push, if someone can explain which function pushes the committed changes, I can try to work on the pull request.
Thank you
The text was updated successfully, but these errors were encountered: