-
Notifications
You must be signed in to change notification settings - Fork 256
fix(version): always stage updated files #1214
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
fix(version): always stage updated files #1214
Conversation
I would rather you add the code to stage the files rather than just have it always return the files if they are not changed. If the files are not changed it should not say it changed them. |
dcdccd6
to
411d3b5
Compare
It took me a minute, but I think you're referring to this log: python-semantic-release/src/semantic_release/cli/commands/version.py Lines 163 to 172 in 5093f30
The simplest and most direct way to stage the files based on what you've said is to stage each file right before returning @codejedi365 If it isn't the right direction, I can further tweak based on your thoughts. Thanks |
Sorry, it seems I was unclear. I was not talking about the log message--I was talking about conceptually what the return value of The implementation that I see to solve this problem revolves around the Now a note about following with the current design pattern, PSR has a |
@codejedi365 Thanks! What you recommended is where I started as well, but I ran into this headwind:
Based on your comment though, it seems like you're OK with me changing the If that's fine with you, I'll work on that this week? I just pushed a very simple mockup of using an enum; if that's in the right direction I'll finish off the logic (still WIP, had to wrap up for the day) and write some tests. Thanks for all the feedback! |
Ok so I continued my work here but I had to change the return of |
I'm gonna wrap this up sometime this week using the current enum direction |
@JonZeolla, sorry I was feeling under the weather this week. I don't think the enum implementation is necessary. It's nice to track all the variations of why and how it stamped the versions in files but we don't do anything with that informational state. The function All I expected that was necessary is to solve this issue is move the git add command above the conditional if related to the This solution solves your issue because in the first execution it stamps the files and then adds them to the index. On the second execution nothing is stamped but when the commit happens it still will commit the entire index which will include the files from the previous PSR execution. What circumstance are you trying to solve with the enum state implementation? |
Is it because if there are no changes then it won't make a commit? I think that will only happen if you don't build/update a changelog in the second execution of PSR. Maybe we adjust your workflow to just make sure that the first execution does not build a changelog. Or we could just evaluate if the index is not empty then we can create a version commit. |
@codejedi365 Aha, so the enum allowed us to ensure that a file whose old content was the same as the new content would get re-added on the second run, as well as the first run. But if you're comfortable having it be added on the first run only, then you're right we only need to move that |
Also yes, for my situation I am skipping changelogs because I'm releasing a number of packages from a single monorepo and don't want the changelog to have confusing contents (pending monorepo support, which I've seen you work on so 👍👍 I will happily wait for that support). Let me look at that code path and push my thoughts here in a bit |
Ok, I have your thoughts pushed now. I also pushed a commit with the updated and working tests via the enum, just for posterity since I had it. I'm gonna look at the tests next to ensure my issue doesn't recur |
This PR is stale because it has not been confirmed or considered ready for merge by the maintainers but has been open 60 days with no recent activity. It will be closed in 10 days, if no further activity occurs. Please make sure to add the proper testing, docs, and descriptions of changes before your PR can be merged. Thank you for your contributions. |
Sorry, @JonZeolla, I got busy. I will try to get this merged in the next week or two. |
No problem @codejedi365 thank you I would love to have some tests to make sure this doesn't recur, but I won't have an opportunity to look into that myself for a number of weeks :/ |
…aged during execution
ab24667
to
b7c486c
Compare
@JonZeolla, If you have time tomorrow, would you take a look at this and maybe try it out (download artifact from CI workflow). I modified a previous version stamp only test to validate that it will stage any files that are stamped with a version. This should resolve your environment. I did not make a test that fully executes uv and a double version execution but I felt that was overkill as it also would of been harder to validate after the second execution. In my point of view, the part that was missing for you was the staging and that is resolved and checked so we should be good to merge & release. I did rebase and overwrite your branch however I do have a local copy of your changes if we needed them. |
…en when provided `--no-commit` Resolves: python-semantic-release#1211
a963278
to
ec27808
Compare
@codejedi365 I just went to test but the artifact was expired. It's a bit hard for me to stay on top of this (mostly because of the notifications getting lost in a sea of other notifications), and this seems to be going in the right direction so I have no reason to hold it up. I also agree, that it seems to have coverage for my scenario right now - ty for that. |
@JonZeolla Thanks! |
ec27808
to
dc16734
Compare
🎉 This PR has been published as part of v10.1.0 🎉You can find more information about this release on the GitHub Releases page. |
Purpose
Fixes #1211
Rationale
This was @codejedi365's suggestion in #1211
How did you test?
See the PR; @codejedi365 wrote automated tests
How to Verify
See the PR; @codejedi365 wrote documentation
PR Completion Checklist
Reviewed & followed the Contributor Guidelines
Changes Implemented & Validation pipeline succeeds
Commits follow the Conventional Commits standard
and are separated into the proper commit type and scope (recommended order: test, build, feat/fix, docs)
Appropriate Unit tests added/updated
Appropriate End-to-End tests added/updated
Appropriate Documentation added/updated and syntax validated for sphinx build (see Contributor Guidelines)