Skip to content

Commit 9c8afef

Browse files
authored
ci: fix pr-preview-action pr check failures (#1091)
1 parent d1be412 commit 9c8afef

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

.github/workflows/preview.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# .github/workflows/preview.yml
22
name: Deploy PR previews
33
permissions:
4-
contents: write
4+
contents: read
55
concurrency:
66
group: preview-${{ github.workflow }}-${{ github.ref }}
77
cancel-in-progress: true
@@ -16,7 +16,13 @@ on:
1616
jobs:
1717
deploy-preview:
1818
runs-on: ubuntu-latest
19-
if: github.actor != 'dependabot[bot]'
19+
if: |
20+
github.actor != 'dependabot[bot]' &&
21+
github.event.pull_request.draft == false &&
22+
github.event.pull_request.head.repo.full_name == github.repository
23+
permissions:
24+
contents: write # Required for pr-preview-action to push to gh-pages
25+
pull-requests: write # Required for PR comments
2026
steps:
2127
- name: Cached LFS checkout
2228
uses: nschloe/action-cached-lfs-checkout@f46300cd8952454b9f0a21a3d133d4bd5684cfc2
@@ -38,5 +44,13 @@ jobs:
3844

3945
- name: Deploy preview
4046
uses: rossjrw/pr-preview-action@9f77b1d057b494e662c50b8ca40ecc63f21e0887
47+
id: preview-step
4148
with:
4249
source-dir: ./build/
50+
51+
- name: Publish preview link to job summary
52+
if: steps['preview-step'].outputs['deployment-action'] == 'deploy'
53+
run: |
54+
url="${{ steps['preview-step'].outputs['preview-url'] }}"
55+
echo "Preview visible at ${url}" >> "$GITHUB_STEP_SUMMARY"
56+
echo "[Open preview](${url})" >> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)