-
Notifications
You must be signed in to change notification settings - Fork 56
Publish last commit information #286
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
Conversation
|
@jorgepiloto @mkundu1 I came up with a less intrusive and more elegant solution (which does not imply committing anything on the fly). I created a new Makefile target called "last-commit-info" which basically appends to the README.rst file a brief summary of the last commit of the branch in question. Then, when the install-post target is called and the packages generated, the PKG-INFO file contains the README.rst in its "long description" field. Thus, now the information of the last commit is available whenever the package is generated in CI (for any branch). Please, see below an example of the modifications this new target does |
|
I'm not sure if it possible to access PKG-INFO from the Python REPL. What about the following?
git --no-pager log -n 1 --format='%an <%ae> - %ad - %h' | xargs -I hash sed -i "s/LAST_COMMIT.*/LAST_COMMIT = \"hash\"/g" ansys/fluent/core/__init__.pyThen, developers and users can run: |
Fine by me as well. Looks quite nice in fact =) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice, thanks
OK, so if we are going there why not: and it prints something like I think you can use |
Fine, I'll include this modification as well =) I'll keep the variable though, and let the method return the string. Though I'll force the variable to be private now (i.e. "__LAST_COMMIT"). |
Yes, makes sense it can be private. Since it's not just the 'last commit' you might call it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only concern is if changes applied during the CI are commited to the actual repository. I think some kind of token needs to be used to effectively apply these changes to the codebase.
Changes are not commited. They are included as part of the package generation, let's say. Thus it is not needed to push anything, and consequently, no need of token is necessary. |
You are right! This is only included when building the package as discussed in private. |
Co-authored-by: Jorge Martínez <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀


Resolves #282