-
Notifications
You must be signed in to change notification settings - Fork 99
fix: auto release on mirror updates #83
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
Merged
+27
−21
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This seems fine but I wonder if
mirror.pyshould indicate if this needs to happen or not? Perhaps for tracking in a follow-upThere 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.
The created variable allows for any extra function to be added based on
$changes_exist. Makingmirror.pysend out some type of signal doesn't make the most sense to me. But maybe you have something specific in mind?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.
Well it could be as simple as "echo "changes_exist=$(python mirror.py)" >> $GITHUB_ENV" and having
mirror.pyemittrueorfalseto STDOUT. The idea here is thatmirror.pywould say if you need to publish a release instead of checking for extra commits and releasing based on a side-effect which is more likely to be error prone.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.
I think I figured out a way to make this work. However, it is dependent on side effects. So let us say we changed mirror.py to look like:
https://github.com/CoderJoshDK/ruff-pre-commit/blob/a628536dcda0210e9733cf7056947769fc58e4b4/mirror.py#L12-L25
And then changed
main.ymlto look like:https://github.com/CoderJoshDK/ruff-pre-commit/blob/a628536dcda0210e9733cf7056947769fc58e4b4/.github/workflows/main.yml#L33-L42
It would roughly do what you want. However, there are multiple issues with this approach. It works (should, will make sure to do more testing if you are ok with this issue) but only because of the side effect where the subprocess in mirror writes to STDOUT. And so now we end up trading one side effect for another. If you still feel that this is cleaner, that is fine, and I can put these changes in.
Example output:
And if you do want this change, do you want it as a separate PR?
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.
Ah I would not depend on the subprocess writing to stdout that's too confusing. Let's just consider this separately there's no reason to slow down this fix. I probably ought to actually look at it myself.
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.
You could always have it print out some random value when a commit is made, just to double make sure a write to the
STDOUTis done. But the code ends up being exactly the same with an extraprint.Personally, I feel like the current state of things is easier to follow. Being too cleaver might not actually make anything better. Regardless, I am interested to see if you manage to think of a solution.