Fix preview build on contributor PRs (#7597)

- I broke this in #7577 

`pull_request` workflows don't have permission to comment, so we have to
do this via a `pull_request_target` workflow.

The point of this early comment is that the kitdiff link appears as soon
as possible and isn't dependent on the preview build suceeding.
This commit is contained in:
Lucas Meurer 2025-10-08 10:20:12 +02:00 committed by GitHub
parent 683214bfe8
commit c3c08fa38a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 14 deletions

View File

@ -17,20 +17,6 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 60 timeout-minutes: 60
steps: steps:
- name: Comment PR
uses: thollander/actions-comment-pull-request@v2
env:
URL_SLUG: ${{ github.event.number }}-${{ github.head_ref }}
with:
message: |
Preview is being built...
Preview will be available at https://egui-pr-preview.github.io/pr/${{ env.URL_SLUG }}
View snapshot changes at [kitdiff](https://rerun-io.github.io/kitdiff/?url=${{ github.event.pull_request.html_url }})
comment_tag: 'egui-preview'
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@stable
with: with:

23
.github/workflows/preview_comment.yml vendored Normal file
View File

@ -0,0 +1,23 @@
name: preview_comment.yml
on:
pull_request_target:
types: [opened]
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Comment PR
uses: thollander/actions-comment-pull-request@v2
env:
URL_SLUG: ${{ github.event.number }}-${{ github.head_ref }}
with:
message: |
Preview is being built...
Preview will be available at https://egui-pr-preview.github.io/pr/${{ env.URL_SLUG }}
View snapshot changes at [kitdiff](https://rerun-io.github.io/kitdiff/?url=${{ github.event.pull_request.html_url }})
comment_tag: 'egui-preview'