Skip to content

Commit c835f8d

Browse files
Fix preview comment (#1531)
* Fix preview comment * Update .github/workflows/preview-build.yml Co-authored-by: Liam Thompson <[email protected]> --------- Co-authored-by: Liam Thompson <[email protected]>
1 parent 826c3ba commit c835f8d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

.github/workflows/preview-build.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ jobs:
145145
pull-requests: none
146146
outputs:
147147
deployment_result: ${{ steps.deployment.outputs.result }}
148+
path_prefix: ${{ steps.generate-path-prefix.outputs.result }}
148149
env:
149150
GITHUB_PR_REF_NAME: ${{ github.event.pull_request.head.ref }}
150151
MATCH: ${{ needs.match.outputs.content-source-match }}
@@ -203,6 +204,7 @@ jobs:
203204
return deployment.data.id
204205
205206
- name: Generate env.PATH_PREFIX
207+
id: generate-path-prefix
206208
if: >
207209
env.MATCH == 'true'
208210
&& steps.deployment.outputs.result
@@ -212,16 +214,18 @@ jobs:
212214
run: |
213215
case "${GITHUB_EVENT_NAME}" in
214216
"merge_group" | "pull_request" | "pull_request_target")
215-
echo "PATH_PREFIX=/${GITHUB_REPOSITORY}/pull/${PR_NUMBER}" >> $GITHUB_ENV
217+
path_prefix="/${GITHUB_REPOSITORY}/pull/${PR_NUMBER}"
216218
;;
217219
"push" | "workflow_dispatch")
218-
echo "PATH_PREFIX=/${GITHUB_REPOSITORY}/tree/${GITHUB_REF_NAME}" >> $GITHUB_ENV
220+
path_prefix="/${GITHUB_REPOSITORY}/tree/${GITHUB_REF_NAME}"
219221
;;
220222
*)
221223
echo "Unsupported event: '${GITHUB_EVENT_NAME}'";
222224
exit 1;
223225
;;
224226
esac
227+
echo "PATH_PREFIX=${path_prefix}" >> $GITHUB_ENV
228+
echo "result=${path_prefix}" >> $GITHUB_OUTPUT
225229
226230
- name: Bootstrap Action Workspace
227231
if: >
@@ -365,6 +369,7 @@ jobs:
365369
uses: actions/github-script@v7
366370
env:
367371
ALL_CHANGED_FILES: ${{ needs.check.outputs.all_changed_files }}
372+
PATH_PREFIX: ${{ needs.build.outputs.path_prefix }}
368373
with:
369374
script: |
370375
const title = '## 🔍 Preview links for changed docs'

0 commit comments

Comments
 (0)