@@ -25,41 +25,44 @@ jobs:
25
25
BASE_REF : ${{ github.event.pull_request.base.ref }}
26
26
run : |
27
27
merge_base="$(git merge-base "origin/${BASE_REF}" HEAD)"
28
- echo "Merge base is '${merge_base}'"
29
28
echo "MERGE_BASE=${merge_base}" >> "$GITHUB_OUTPUT"
29
+ echo "Merge base is '${merge_base}'"
30
30
31
31
- name : Get CircleCI job details
32
32
id : get-circleci-job-details
33
33
env :
34
- REPOSITORY : ${{ github.repository }}
34
+ OWNER : ${{ github.repository_owner }}
35
+ REPOSITORY : ${{ github.event.repository.name }}
36
+ # For a `pull_request` event, the branch is `github.head_ref``.
35
37
BRANCH : ${{ github.head_ref }}
38
+ # For a `pull_request` event, the head commit hash is `github.event.pull_request.head.sha`.
36
39
HEAD_COMMIT_HASH : ${{ github.event.pull_request.head.sha }}
40
+ JOB_NAME : job-publish-prerelease
37
41
run : |
38
- 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" )
42
+ 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' )
39
43
workflow_id=$(curl --silent "https://circleci.com/api/v2/pipeline/$pipeline_id/workflow" | jq -r ".items[0].id")
40
- job_details=$(curl --silent "https://circleci.com/api/v2/workflow/$workflow_id/job" | jq -r '.items[] | select(.name == "job-publish-prerelease")')
41
- build_num=$(echo "$job_details" | jq -r '.job_number')
44
+ 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)')
42
45
46
+ build_num=$(echo "$job_details" | jq -r '.job_number')
43
47
echo 'CIRCLE_BUILD_NUM='"$build_num" >> "$GITHUB_OUTPUT"
48
+
44
49
job_id=$(echo "$job_details" | jq -r '.id')
45
50
echo 'CIRCLE_WORKFLOW_JOB_ID='"$job_id" >> "$GITHUB_OUTPUT"
46
51
47
- echo "Getting artifacts from pipeline '${pipeline_id}', workflow '${workflow_id}', build number '${build_num}', job ID '${job_id}'"
52
+ echo "Getting artifacts from pipeline '${pipeline_id}', workflow '${workflow_id}', build number '${build_num}', job id '${job_id}'"
48
53
49
54
- name : Get CircleCI job artifacts
50
55
env :
51
56
CIRCLE_WORKFLOW_JOB_ID : ${{ steps.get-circleci-job-details.outputs.CIRCLE_WORKFLOW_JOB_ID }}
52
57
run : |
53
- mkdir -p " test-artifacts/chrome/benchmark"
58
+ mkdir -p test-artifacts/chrome/benchmark
54
59
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"
55
60
56
- bundle_size=$(curl --silent --location "https://output.circle-artifacts.com/output/job/${CIRCLE_WORKFLOW_JOB_ID}/artifacts/0/test-artifacts/chrome/bundle_size.json")
57
- mkdir -p "test-artifacts/chrome"
58
- echo "${bundle_size}" > "test-artifacts/chrome/bundle_size.json"
61
+ mkdir -p test-artifacts/chrome
62
+ 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"
59
63
60
- stories=$(curl --silent --location "https://output.circle-artifacts.com/output/job/${CIRCLE_WORKFLOW_JOB_ID}/artifacts/0/storybook/stories.json")
61
- mkdir "storybook-build"
62
- echo "${stories}" > "storybook-build/stories.json"
64
+ mkdir storybook-build
65
+ curl --silent --location "https://output.circle-artifacts.com/output/job/${CIRCLE_WORKFLOW_JOB_ID}/artifacts/0/storybook/stories.json" > "storybook-build/stories.json"
63
66
64
67
- name : Publish prerelease
65
68
env :
0 commit comments