-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Release PR is closed when updating #1487
Comments
Hi Bas, thank you for you kind words ❤️
I also experienced it once in release-plz repo itself. I think it's due to #1459 which fixed signed commits when release-plz updates the PR. To fix this, I need a reproduction. I.e. a repository that I can fork, where you can observe this behavior by running If anybody is able to submit a reproduction it would be great, so I can fix this issue and also keep the signed commits fix. If we can't find a reproduction we can revert #1459 but then it would be hard to add the signed commit fix again, because we would be scared of introducing this bug again. So I would really prefer to fix this bug instead of reverting. I don't have time and resources to find a reproduction myself. If somebody can find a reproduction, it would be awesome 🙏 If you are too annoyed by this issue, you can use release-plz version 0.3.66 (action version v0.5.56) for now. Thanks for understanding and sorry for the trouble, I hope this tradeoff (not reverting) I'm making doesn't annoy anyone too much. If yes, let's talk about it. 🙏 |
I'm experiencing this too; examples are zip-rs/zip2#147 and zip-rs/zip2#152, both of which I had to manually reopen. You should be able to fork https://github.com/zip-rs/zip2 and tag releases without affecting real users, since the custom secret is always used for |
To avoid doing cargo publish you can do the following:
Are you able to fork the repo and give reproduction steps? |
I was thinking. An alternative to the current flow, is to commit the changes on top of the previous commits, instead of force pushing. What do you think? 🤔 |
I'm in favor, but would the CHANGELOG still be well-defined in that case? |
Sounds good to me too! |
The content of the pr doesn't change imo. |
I understood why this issue is happening. GitHub closes the PR if is "empty", i.e. there are no commits that differ from main. The approach I described without force-push requires more thought because in this case we need to understand how to deal with merge conflicts (force push solves this issue). So no reproduction needed, I'll try to solve this issue in the following days 👍 |
Btw if anybody wants to give this a try, feel free. Pr welcome |
This is not possible, because as soon as we force push, the commit created with github api becomes unverified. So maybe we need to stop force pushing 🤔 My guess is that instead of force-pushing, we need to use GitHub API to push the new changes. |
I read renovate's code. So it seems we have two options:
cc @zvolin as you might be interested in this discussion, and it would be great to hear your opinion 🙏 |
Interesting, I'll read through it and see. I remember I was testing this with running release-plz from shell and it worked perfectly fine here. I'm not sure why this shouldn't be the case when running from CI, or maybe I made something differently 🤔 |
I don't like that idea but a quick work around could be to just re-open the PR instantly with github cli after the force push and commit |
I just checked and in lumina we also got the release pr closed. |
Committing with rest api doesn't seem to get the I ran this test. git checkout -b abc
echo foo > README.md
git add -u && git commit -m foo && git push origin abc create a new commit with some changes echo bar > README.md
git add -u && git commit -m bar get the tree of the latter commit. Tree is basically the 'state' part of commit, all blobs etc. git cat-file -p "$(git rev-parse HEAD)"
tree 29aa1bf150e8ce459bbb2ccef4fbaa0b15701ce8
parent ce97bd268c6281d4b59a64efa8adcb579a6e04de
author zvolin <[email protected]> 1717940382 +0200
committer zvolin <[email protected]> 1717940382 +0200
bar store the tree object somewhere in github git push origin 29aa1bf150e8ce459bbb2ccef4fbaa0b15701ce8:refs/release-plz/trees/29aa1bf150e8ce459bbb2ccef4fbaa0b15701ce8 create new commit with gh rest api, using this tree but having
It worked, but as you can see it's not We can test the force-push anyway, update the curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/zvolin/test-release-plz/git/refs/heads/abc \
-d '{"sha":"4ec02c28533b98720c7f33c7cbec93d6da2d5c2e","force":true}'
{
"ref": "refs/heads/abc",
"node_id": "REF_kwDOLDtSTq5yZWZzL2hlYWRzL2FiYw",
"url": "https://api.github.com/repos/zvolin/test-release-plz/git/refs/heads/abc",
"object": {
"sha": "4ec02c28533b98720c7f33c7cbec93d6da2d5c2e",
"type": "commit",
"url": "https://api.github.com/repos/zvolin/test-release-plz/git/commits/4ec02c28533b98720c7f33c7cbec93d6da2d5c2e"
}
} We could now remove the ref for the tree that we created to clean up. So unfortunately commits created this way don't have the signature generated automatically for an authorized user but rather requires providing a pgp signature in api call, which has it's known drawbacks. I was hoping we could get rid of the graphql part when committing and only use the rest api all the way... We could solve the issue by force-pushing to github in this way:
I'll see how bad does it look in a code |
Thanks for testing this 🙌 🙏
Yeah, that could work! Maybe let's attach a random string to the target branch. I.e.
Thanks ❤️ |
I've just noticed that I copy pasted commands from docs in older versions of github api. |
Co-authored-by: Marco Ieni <[email protected]>
Thanks Maciej for the fix 🙌 |
I think it worked for me then because I added commit on master and didn't push it to github before running release-plz release-pr again |
From my understanding release-plz wasn't always closing the pr. Anyway, now it should be solved! |
Bug description
In this repository Im making extensive use of release-plz. I absolute love it. However, for a little while now it appears that when release-plz updates the release PR it immediately closes it. I cannot find anything in the logs that suggests that release-plz is doing this.
To Reproduce
I dont have isolated steps to reproduce this issue but I can show steps that exhibit this behavior in the aformentioned repository.
If you take a look at all the workflow runs of release-plz for the main branch: https://github.com/mamba-org/rattler/actions/workflows/release-rust.yaml
You can see that when PR 666 was merged release-plz create a new release PR. This is the workflow run: https://github.com/mamba-org/rattler/actions/runs/9186703934/job/25262873395
Release-plz notices changes in some of the crates and opens a release PR as can be seen in the logs:
However the next run of release-plz (the release pr was not merged), seems to update the release PR.
Indeed the release PR also includes the changes of the last merged PR. However, it was also immediately closed. Reading the logs I can see no indication as to why this would happen.
Expected behavior
I would expect the release PR to not be closed. Manually reopening and merging the PR seems to be the workaround.
Screenshots
Environment
Additional context
The text was updated successfully, but these errors were encountered: