Skip to content

Commit f880219

Browse files
committed
WIP
1 parent 67ad130 commit f880219

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

.github/workflows/preview.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ jobs:
1818
script: |
1919
const script = require('./.github/download_workflow_run_artifact.js');
2020
let fs = require('fs');
21-
await script({github, context, core, fs, artifact_name: 'pr'});
21+
await script({github, context, core, fs, artifact_name: 'pr.json'});
2222
2323
- name: Unzip artifact
24-
run: unzip pr.zip
24+
run: unzip pr.json.zip
2525

2626
- name: Read PR data
2727
run: echo "PR_DATA=$(cat ./pr.json)" >> $GITHUB_ENV
@@ -30,9 +30,10 @@ jobs:
3030
uses: marocchino/sticky-pull-request-comment@v2
3131
with:
3232
number: ${{ fromJSON(env.PR_DATA).pr_number }}
33-
message: "The PR preview for ${{ fromJSON(env.PR_DATA).head_sha }} could not be generated"
33+
message: "The PR preview for ${{ github.event.workflow_run.head_sha }} could not be generated"
3434

3535
preview:
36+
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
3637
runs-on: ubuntu-latest
3738
steps:
3839
# TODO: can this download from the existing pages or a cache?
@@ -84,7 +85,7 @@ jobs:
8485

8586
- name: Generate summary
8687
run: |
87-
echo "The PR preview for ${{ fromJSON(env.PR_DATA).head_sha }} is available at [${{ env.PREVIEW_DOMAIN }}](https://${{ env.PREVIEW_DOMAIN }})" >> pr.md
88+
echo "The PR preview for ${{ github.event.workflow_run.head_sha }} is available at [${{ env.PREVIEW_DOMAIN }}](https://${{ env.PREVIEW_DOMAIN }})" >> pr.md
8889
echo "" >> pr.md
8990
9091
if [[ -f preview/diff.txt ]] ; then

.github/workflows/test.yml

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

2525
- name: Save PR metadata
2626
run: |
27-
mkdir -p ./pr
28-
echo '{"pr_number": ${{ github.event.number }}, "branch_name": "${{ env.BRANCH_NAME }}", "target_name": "${{ env.TARGET_NAME }}", "head_sha": "${{ github.event.pull_request.head.sha }}"}' > ./pr/pr.json
27+
echo '{"pr_number": ${{ github.event.number }}}' > ./pr.json
2928
3029
- uses: actions/upload-artifact@v4
3130
with:
32-
name: pr
33-
path: ./pr/
31+
name: pr.json
32+
path: ./pr.json

0 commit comments

Comments
 (0)