googleapis / repo-automation-bots

A collection of bots, based on probot, for performing common maintenance tasks across the open-source repos managed by Google on GitHub.
Apache License 2.0
620 stars 122 forks source link

Snippet-bot: support branch builds #5048

Open nicain opened 1 year ago

nicain commented 1 year ago

Internal googler here

cl/529194834 (xref b/278605884) added kokoro support for continuous branch builds based on regex. This unblocked adopting the Merge Queue github feature for kokoro-based Required checks. However, snippet-bot is not checking on these commits. (https://screenshot.googleplex.com/7WwabdGm8Yocd9J)

Can we add a branch-regex-based check option for snippetbot? That will get us one step closer for Merge Queue

nicain commented 1 year ago

Looks like we need to add a (app: Probot).on("push") filtered by a regex against a regex configured in the config file. Then a new function will be needed similar to scanPullRequest ("scanBranch" ?) will be needed, which builds from the result of Octokit.branch.

chingor13 commented 1 year ago

For scanning a PR, I don't see anything in the code restricting which base branch it runs against.

For the nightly scanning of the repo, that could be something that we add configuration for and run on multiple branches.

nicain commented 1 year ago

For scanning a PR, I don't see anything in the code restricting which base branch it runs against.

I agree! so it comes down to a question of triggering, right?

As best I can tell, GH Merge Queue (MQ) will create a branch conforming to the regex: gh-readonly-queue/main/pr-.* when the user presses the "Merge When Read" button (which replaces the "Squash and Merge" button, when MQ is activated on the branch)

This new branch adds a new commit to the PR feature branch, but I don't think it emits any events that the snippet-bot (scanning the PR) would be able to trigger on. Also, snippet-bot would need to figure out which commit (HEAD of the new regex-conforming branch) to verify.