Skip to content

Commit c437772

Browse files
committed
WIP
1 parent a76609f commit c437772

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

.github/workflows/preview.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ jobs:
1919
script: |
2020
const script = require('./.github/download_workflow_run_artifact.js');
2121
let fs = require('fs');
22-
await script({github, context, core, fs, artifact_name: 'pr.json'});
22+
await script({github, context, core, fs, artifact_name: 'pr'});
2323
2424
- name: Unzip artifact
25-
run: unzip pr.json.zip
25+
run: unzip pr.zip
2626

2727
- name: Read PR data
28-
run: echo "PR_DATA=$(cat ./pr.json)" >> $GITHUB_ENV
28+
run: echo "PR_NUMBER=$(cat ./pr)" >> $GITHUB_ENV
2929

3030
- name: Comment on PR
3131
uses: marocchino/sticky-pull-request-comment@v2
3232
with:
33-
number: ${{ fromJSON(env.PR_DATA).pr_number }}
33+
number: ${{ env.PR_NUMBER }}
3434
message: "The PR preview for ${{ github.event.workflow_run.head_sha }} could not be generated"
3535

3636
preview:
@@ -75,8 +75,22 @@ jobs:
7575
diffstat -l -p2 preview/diff.patch > diff.txt
7676
fi
7777
78+
- name: Download metadata artifact
79+
uses: actions/github-script@v7
80+
with:
81+
script: |
82+
const script = require('./.github/download_workflow_run_artifact.js');
83+
let fs = require('fs');
84+
await script({github, context, core, fs, artifact_name: 'pr'});
85+
86+
- name: Unzip artifact
87+
run: unzip pr.zip
88+
89+
- name: Read PR data
90+
run: echo "PR_NUMBER=$(cat ./pr)" >> $GITHUB_ENV
91+
7892
- name: Set preview domain
79-
run: echo "PREVIEW_DOMAIN=$(echo ${{ github.repository }} | tr / - )-${{ github.job }}-pr-${{ fromJSON(env.PR_DATA).pr_number }}.surge.sh" >> $GITHUB_ENV
93+
run: echo "PREVIEW_DOMAIN=$(echo ${{ github.repository }} | tr / - )-${{ github.job }}-pr-${{ env.PR_NUMBER }}.surge.sh" >> $GITHUB_ENV
8094

8195
- name: Install surge
8296
run: npm install surge
@@ -109,5 +123,5 @@ jobs:
109123
- name: Comment on PR
110124
uses: marocchino/sticky-pull-request-comment@v2
111125
with:
112-
number: ${{ fromJSON(env.PR_DATA).pr_number }}
126+
number: ${{ env.PR_NUMBER }}
113127
path: pr.md

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ jobs:
2424

2525
- name: Save PR metadata
2626
run: |
27-
echo '{"pr_number": ${{ github.event.number }}}' > ./pr.json
27+
echo ${{ github.event.number }} > ./pr
2828
2929
- uses: actions/upload-artifact@v4
3030
with:
31-
name: pr.json
32-
path: ./pr.json
31+
name: pr
32+
path: ./pr

0 commit comments

Comments
 (0)