Skip to content

Commit

Permalink
fix: metamaskbot comment nits (#29636)
Browse files Browse the repository at this point in the history
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/29636?quickstart=1)

This PR adds minor fixes and enhancements to things that were not worth
blocking the original metamaskbot PR for. Things like, comments, style,
reusability should be improved by this PR. Interestingly, I also saw
that the `$OWNER` environment variable was missing, but somehow the
workflow still worked. I added this environment variable just to make it
sane.

## **Related issues**

Fixes: #28572

## **Manual testing steps**

1. Everything should still work

## **Screenshots/Recordings**

Not applicable

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
itsyoboieltr authored Jan 10, 2025
1 parent f58258b commit b2c5314
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions .github/workflows/publish-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,41 +25,44 @@ jobs:
BASE_REF: ${{ github.event.pull_request.base.ref }}
run: |
merge_base="$(git merge-base "origin/${BASE_REF}" HEAD)"
echo "Merge base is '${merge_base}'"
echo "MERGE_BASE=${merge_base}" >> "$GITHUB_OUTPUT"
echo "Merge base is '${merge_base}'"
- name: Get CircleCI job details
id: get-circleci-job-details
env:
REPOSITORY: ${{ github.repository }}
OWNER: ${{ github.repository_owner }}
REPOSITORY: ${{ github.event.repository.name }}
# For a `pull_request` event, the branch is `github.head_ref``.
BRANCH: ${{ github.head_ref }}
# For a `pull_request` event, the head commit hash is `github.event.pull_request.head.sha`.
HEAD_COMMIT_HASH: ${{ github.event.pull_request.head.sha }}
JOB_NAME: job-publish-prerelease
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")
pipeline_id=$(curl --silent "https://circleci.com/api/v2/project/gh/$OWNER/$REPOSITORY/pipeline?branch=$BRANCH" | jq --arg head_commit_hash "${HEAD_COMMIT_HASH}" -r '.items | map(select(.vcs.revision == $head_commit_hash)) | first | .id')
workflow_id=$(curl --silent "https://circleci.com/api/v2/pipeline/$pipeline_id/workflow" | jq -r ".items[0].id")
job_details=$(curl --silent "https://circleci.com/api/v2/workflow/$workflow_id/job" | jq -r '.items[] | select(.name == "job-publish-prerelease")')
build_num=$(echo "$job_details" | jq -r '.job_number')
job_details=$(curl --silent "https://circleci.com/api/v2/workflow/$workflow_id/job" | jq --arg job_name "${JOB_NAME}" -r '.items[] | select(.name == $job_name)')
build_num=$(echo "$job_details" | jq -r '.job_number')
echo 'CIRCLE_BUILD_NUM='"$build_num" >> "$GITHUB_OUTPUT"
job_id=$(echo "$job_details" | jq -r '.id')
echo 'CIRCLE_WORKFLOW_JOB_ID='"$job_id" >> "$GITHUB_OUTPUT"
echo "Getting artifacts from pipeline '${pipeline_id}', workflow '${workflow_id}', build number '${build_num}', job ID '${job_id}'"
echo "Getting artifacts from pipeline '${pipeline_id}', workflow '${workflow_id}', build number '${build_num}', job id '${job_id}'"
- name: Get CircleCI job artifacts
env:
CIRCLE_WORKFLOW_JOB_ID: ${{ steps.get-circleci-job-details.outputs.CIRCLE_WORKFLOW_JOB_ID }}
run: |
mkdir -p "test-artifacts/chrome/benchmark"
mkdir -p test-artifacts/chrome/benchmark
curl --silent --location "https://output.circle-artifacts.com/output/job/${CIRCLE_WORKFLOW_JOB_ID}/artifacts/0/test-artifacts/chrome/benchmark/pageload.json" > "test-artifacts/chrome/benchmark/pageload.json"
bundle_size=$(curl --silent --location "https://output.circle-artifacts.com/output/job/${CIRCLE_WORKFLOW_JOB_ID}/artifacts/0/test-artifacts/chrome/bundle_size.json")
mkdir -p "test-artifacts/chrome"
echo "${bundle_size}" > "test-artifacts/chrome/bundle_size.json"
mkdir -p test-artifacts/chrome
curl --silent --location "https://output.circle-artifacts.com/output/job/${CIRCLE_WORKFLOW_JOB_ID}/artifacts/0/test-artifacts/chrome/bundle_size.json" > "test-artifacts/chrome/bundle_size.json"
stories=$(curl --silent --location "https://output.circle-artifacts.com/output/job/${CIRCLE_WORKFLOW_JOB_ID}/artifacts/0/storybook/stories.json")
mkdir "storybook-build"
echo "${stories}" > "storybook-build/stories.json"
mkdir storybook-build
curl --silent --location "https://output.circle-artifacts.com/output/job/${CIRCLE_WORKFLOW_JOB_ID}/artifacts/0/storybook/stories.json" > "storybook-build/stories.json"
- name: Publish prerelease
env:
Expand Down

0 comments on commit b2c5314

Please sign in to comment.