-
Notifications
You must be signed in to change notification settings - Fork 5k
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
ci: Migrate metamaskbot PR comment #29373
base: main
Are you sure you want to change the base?
Conversation
051cd52
to
3cbc139
Compare
Builds ready [6a4182e]
Bundle size diffs
|
Builds ready [dc9fd81]
Page Load Metrics (1422 ± 42 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
Builds ready [fb737b2]
Page Load Metrics (1766 ± 68 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
Builds ready [44f95d4]
Page Load Metrics (1610 ± 85 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
54e05e1
to
0bce5e0
Compare
Builds ready [0bce5e0]
Page Load Metrics (1771 ± 75 ms)
Bundle size diffs
|
0bce5e0
to
e10477e
Compare
@@ -9,7 +9,7 @@ async function getHighlights({ artifactBase }) { | |||
// here we assume the PR base branch ("target") is `main` in lieu of doing | |||
// a query against the github api which requires an access token | |||
// see https://discuss.circleci.com/t/how-to-retrieve-a-pull-requests-base-branch-name-github/36911 | |||
const changedFiles = await getChangedFiles({ target: 'main' }); | |||
const changedFiles = await getChangedFiles({ target: 'origin/main' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now running on GitHub Actions rather than CircleCI, which doesn't checkout the main branch locally. origin/main
works across both CI systems.
BRANCH: ${{ github.head_ref }} | ||
HEAD_COMMIT_HASH: ${{ github.event.pull_request.head.sha }} | ||
run: | | ||
pipeline_id=$(curl --silent "https://circleci.com/api/v2/project/gh/$OWNER/$REPOSITORY/pipeline?branch=$BRANCH" | jq -r ".items | map(select(.vcs.revision == \"${HEAD_COMMIT_HASH}\" )) | first | .id") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same strategy as used elsewhere for getting the CircleCI workflow corresponding to the current branch+commit:
pipeline_id=$(curl --silent "https://circleci.com/api/v2/project/gh/$OWNER/$REPOSITORY/pipeline?branch=$BRANCH" | jq -r ".items | map(select(.vcs.revision == \"${HEAD_COMMIT_HASH}\" )) | first | .id") |
|
||
echo "Getting artifacts from pipeline '${pipeline_id}', workflow '${workflow_id}', build number '${build_num}', job ID '${job_id}'" | ||
|
||
- name: Get CircleCI job artifacts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the artifacts referenced in the metamaskbot
comment are referenced by CircleCI artifact link. We didn't need to download those.
These three are pulled from the filesystem by the script though, so we needed to download these.
PR_COMMENT_TOKEN: ${{ secrets.PR_COMMENT_TOKEN }} | ||
PR_NUMBER: ${{ github.event.pull_request.number }} | ||
HEAD_COMMIT_HASH: ${{ github.event.pull_request.head.sha }} | ||
MERGE_BASE_COMMIT_HASH: ${{ steps.get-merge-base.outputs.MERGE_BASE }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is equivalent to the PARENT_COMMIT
used previously, they both use git merge-base
to find the base commit between the current branch and the target branch.
const sourceMapRoot = '/build-artifacts/source-map-explorer/'; | ||
const bundleFiles = await glob(`.${sourceMapRoot}*${fileType}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The strategy used to collect these links was changed. Previously we used glob
to look for these files on the filesystem. It would have been tedious to migrate each file one-by-one between CI systems, so instead we're hard-coding the 5 bundle types and testing each bundle index until we get a 404.
This ensures the links are constructed correctly even as the number of bundles fluctuates (which is common), and it doesn't require transferring the files between CI systems.
Builds ready [2727f61]
Page Load Metrics (1783 ± 125 ms)
Bundle size diffs
|
Description
Migrate the
metamaskbot
PR comment from CircleCI to GitHub Actions. CircleCI is still used for artifact storage for linked artifacts.Related issues
Relates to #28572
These changes were extracted from #29256
Manual testing steps
metamaskbot
comment work correctly, except those that are already broken. Links already broken onmain
include:metamaskbot
comment test build links #29403 ):Screenshots/Recordings
N/A
Pre-merge author checklist
Pre-merge reviewer checklist