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

Detect merge queue branch and retrieve real branch name from pull request #884

Merged
merged 6 commits into from
Jan 16, 2024

Conversation

JonathanKolnik
Copy link
Contributor

@JonathanKolnik JonathanKolnik commented Jan 10, 2024

If the branch matches the merge queue branch pattern, we extract the pull request number from the branch name and query the index for the PRs actual branch name. We then use that for the rest of the build process.

This depends on a change to the index that allows headRefName to be read via the app code https://github.com/chromaui/chromatic/pull/8128

📦 Published PR as canary version: 10.2.3--canary.884.7542729719.0

✨ Test out this PR locally via:

npm install [email protected]
# or 
yarn add [email protected]

@JonathanKolnik JonathanKolnik changed the title detech merge queue branch and retrieve real branch name from pull req… detect merge queue branch and retrieve real branch name from pull request Jan 10, 2024
@JonathanKolnik JonathanKolnik marked this pull request as ready for review January 11, 2024 14:45
@JonathanKolnik JonathanKolnik requested review from ghengeveld, tmeasday and ethriel3695 and removed request for ghengeveld January 11, 2024 14:45
node-src/git/git.ts Outdated Show resolved Hide resolved
@JonathanKolnik
Copy link
Contributor Author

@ethriel3695 looks like you managed to get a merge queue test scenario, could you show me how to do so and if you have time, test this canary too? Thanks!

@ethriel3695
Copy link
Contributor

ethriel3695 commented Jan 11, 2024

@JonathanKolnik
Of course!

https://github.com/chromaui/vite-project/pull/6/files

I changed the GitHub action in my test repo to use the Chromatic script instead of the GitHub Action.
I changed the version of Chromatic in the package.json to point to the Canary version.

From there, I changed some styles in one of the components and created a PR.
I created another branch directly from my branch, changed some styles in a different component, and created a PR.

Then, I merged both PRs into the merge queue.

Logs in place told me the CI branch from the merge queue.

I'll test on this Canary version too.

Copy link
Contributor

@ethriel3695 ethriel3695 left a comment

Choose a reason for hiding this comment

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

@JonathanKolnik
It looks like it worked.

https://www.staging-chromatic.com/build?appId=6567827ff5eb53d578159b6a&number=32
https://www.staging-chromatic.com/build?appId=6567827ff5eb53d578159b6a&number=33

No baselines were detected on either of these merges because the merge queue builds are aware of the previously accepted baseline.

The one thing I'm unclear on is it doesn't look like the branch name changed at all.
https://github.com/chromaui/vite-project/actions/runs/7494123452/job/20401335868
https://github.com/chromaui/vite-project/actions/runs/7494168482/job/20401474600

@ethriel3695
Copy link
Contributor

@JonathanKolnik
On this one, I would feel better if @tmeasday or @ghengeveld can give a second approval.

Copy link
Member

@tmeasday tmeasday left a comment

Choose a reason for hiding this comment

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

This seems right to me!

node-src/git/getCommitAndBranch.ts Outdated Show resolved Hide resolved
@ghengeveld ghengeveld changed the title detect merge queue branch and retrieve real branch name from pull request Detect merge queue branch and retrieve real branch name from pull request Jan 16, 2024
@ghengeveld ghengeveld added minor Auto: Increment the minor version when merged skip-release Auto: Preserve the current version when merged labels Jan 16, 2024
@JonathanKolnik JonathanKolnik added this pull request to the merge queue Jan 16, 2024
Merged via the queue into main with commit 7ae7234 Jan 16, 2024
21 of 23 checks passed
@JonathanKolnik JonathanKolnik deleted the jono/ap-3896-detect-github-merge-queue-builds branch January 16, 2024 14:07
@ghengeveld
Copy link
Member

🚀 PR was released in v10.3.0 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Auto: Increment the minor version when merged released Verdict: This issue/pull request has been released skip-release Auto: Preserve the current version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants