Skip to content
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

build: use purple merge instead of close on CQ #35001

Closed
wants to merge 1 commit into from

Conversation

mmarchini
Copy link
Contributor

If the bot can make modifications to the head branch, force push to the
head branch so it lands with the purple icon on GitHub instead of the
red icon when the PR is closed. Let's gooooooooo!

Ref: nodejs/node-core-utils#264

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

If the bot can make modifications to the head branch, force push to the
head branch so it lands with the purple icon on GitHub instead of the
red icon when the PR is closed. Let's gooooooooo!

Ref: nodejs/node-core-utils#264
@nodejs-github-bot nodejs-github-bot added the tools Issues and PRs related to the tools directory. label Aug 31, 2020
@mmarchini
Copy link
Contributor Author

I most definitely have not tested it yet 🙃

Copy link
Member

@lundibundi lundibundi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should work 😄 , great idea 👍

@@ -76,10 +80,18 @@ for pr in "$@"; do
git node land --abort --yes
else
rm output
head=$(gitHubCurl "$(prUrl "$pr")" GET | jq '{ ref: .head.ref, remote: .head.repo.ssh_url, can_modify: .maintainer_can_modify }')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we split the value right here to avoid the "$(echo "$head" .. below so that it will be a bit cleaner. Perhaps like:

head=$(gitHubCurl "$(prUrl "$pr")" GET)
head_ref="$(echo "$head" | jq -r '.head.ref')"
remote_url="$(echo "$head" | jq -r '.head.repo.ssh_url')"
can_modify="$(echo "$head" | jq -r '.maintainer_can_modify')"

if [ "$(echo "$head" | jq -r .can_modify)" == "true" ]; then
git push --force "$(echo "$head" | jq -r .remote)" master:"$(echo "$head" | jq -r .ref)"
# Give GitHub time to sync before pushing to master
sleep 5s
Copy link
Contributor Author

@mmarchini mmarchini Sep 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might increase this to a whole minute or something, I just did this manually with a 15 seconds gap between push to PR branch and push to nodejs/node and I still got a race condition.

image

Note how even though I pushed to the PR branch first, GitHub only registered the event after I pushed to nodejs/node, which lead to the PR getting automatically closed and losing the commits and file changes in the UI

image

If that's a propagation issue on GitHub (which is what it seems like), an API call to confirm if the push propagated probably wouldn't work :/, so long sleep might be the way to go.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to wait until the origin/pull/123 ref has updated, which a git fetch can verify.

@richardlau
Copy link
Member

I think this has been superseded by #40666?

@Mesteery Mesteery closed this Mar 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants