Add new pr-publish command#7202
Add new pr-publish command#7202jonchang merged 3 commits intoHomebrew:masterfrom jonchang:pr-publish
pr-publish command#7202Conversation
|
But Jon, you didn't merge the PR commit to master. Mednafen is still on previous version, while the bottle is on the newest. |
MikeMcQuaid
left a comment
There was a problem hiding this comment.
A few suggested style tweaks/cleanups but looks good, great work again!
| switch :verbose | ||
| end | ||
| end | ||
|
|
||
| def pr_publish | ||
| pr_publish_args.parse | ||
|
|
||
| odie "You need to specify a pull request number!" if Homebrew.args.named.empty? |
There was a problem hiding this comment.
| switch :verbose | |
| end | |
| end | |
| def pr_publish | |
| pr_publish_args.parse | |
| odie "You need to specify a pull request number!" if Homebrew.args.named.empty? | |
| switch :verbose | |
| named 1 | |
| end | |
| end | |
| def pr_publish | |
| pr_publish_args.parse |
| comments.any? { |comment| comment["body"].eql?(body) } | ||
| end | ||
|
|
||
| def dispatch(user, repo, event, **payload) |
There was a problem hiding this comment.
| def dispatch(user, repo, event, **payload) | |
| def repo_dispatch_event(user, repo, event, **payload) |
or
| def dispatch(user, repo, event, **payload) | |
| def dispatch_event(user, repo, event, **payload) |
| tap = Tap.fetch(user, repo) if repo.match?(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX) | ||
| odie "Not a GitHub pull request: #{arg}" unless issue | ||
| ohai "Dispatching #{tap} pull request ##{issue}" | ||
| GitHub.dispatch(user, repo, "Publish ##{issue}", pull_request: issue) |
There was a problem hiding this comment.
Could this (or a line after) output a URL that you can use to check progress? If not possible: no worries.
There was a problem hiding this comment.
This unfortunately returns 204 No Content. We'd have to find it using another API call.
There was a problem hiding this comment.
😭. Even if it outputs the full PR URL somewhere that might be nice. Where does the "action" show up; just in the actions tab on the repo?
There was a problem hiding this comment.
Yup, just in the Actions tab. You can filter by actor and workflow type though which can help. In Linuxbrew/core we have @BrewTestBot ping the requestor when the upload job fails. This could be added to the workflow in Homebrew/core:
https://github.com/Homebrew/linuxbrew-core/blob/3d460c215425e7d1547865ad0c2f5b4b7bce7dd7/.github/workflows/upload-bottles.yml#L165-L173
https://github.com/Homebrew/linuxbrew-core/pull/19902#issuecomment-601881442
There was a problem hiding this comment.
Yeh, this would be great to have there too 👍
Fixed! |
|
Great work! I've tested it and noticed that in the bottle commit, the sign-off email is different than what we usually see when using Is that expected? |
Yes, it either uses your public GitHub email address or your noreply address to associate the commit with your account. See https://help.github.com/en/github/setting-up-and-managing-your-github-user-account/setting-your-commit-email-address |
|
Just to check: presumably this means that any sort of squashing, commit rewording etc will no longer be possible and will now require asking the pull request author to do so and run a new CI build? |
With this workflow, yes. Either a maintainer or the pull request author would need to make these changes on the pull request branch. I'm not sure how we could do something similar to our current workflow with GitHub Actions. |
|
I suppose the payload could be used, but the different scenarios probably would make it get complex very fast. |
brew stylewith your changes locally?brew testswith your changes locally?This is the maintainer-facing command we need before switching over to GitHub Actions with self-hosted runners.
This new command issues a single GitHub API call to fire the
repository_dispatchevent, which starts this workflow in Homebrew/core: https://github.com/Homebrew/homebrew-core/blob/master/.github/workflows/publish-commit-bottles.ymlThe workflow:
brew pr-publishbrew test-bot --ci-upload --publish(c.f. test-bot: use separate API call on publish homebrew-test-bot#344)brew pull --bottle)masterMaintainers who want to opt-in to the new workflow should simply run
brew pr-publish <pr> [<pr> ...]. This will use the GitHub Actions bottles rather than the Jenkins bottles. The Jenkins workflow can still be used withbrew pull --bottle <pr>.Example of a successful run: