mirror of https://github.com/django/django.git
Changed the screenshots Github workflow to run in the PR's branch by using pull_request as event trigger.
The original event trigger pull_request_target runs against the target branch (main), not the branch associated with the PR. Consequently, any new screenshots added in a PR are not captured, and the available screenshots reflect the state of the main branch code, not the code from the PR's branch. This update addresses the issue by changing the event trigger to pull_request. However, it's important to note that this adjustment breaks the comments functionality since the action no longer has write permissions.
This commit is contained in:
parent
a93375e8ab
commit
ed65610653
|
@ -1,7 +1,7 @@
|
||||||
name: Visual Regression Tests
|
name: Visual Regression Tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request_target:
|
pull_request:
|
||||||
types: [labeled, synchronize, opened, reopened]
|
types: [labeled, synchronize, opened, reopened]
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
|
@ -45,35 +45,3 @@ jobs:
|
||||||
with:
|
with:
|
||||||
name: screenshots-${{ github.event.pull_request.head.sha }}
|
name: screenshots-${{ github.event.pull_request.head.sha }}
|
||||||
path: tests/screenshots/
|
path: tests/screenshots/
|
||||||
|
|
||||||
- name: Find comment to update
|
|
||||||
uses: peter-evans/find-comment@v2
|
|
||||||
id: find-comment
|
|
||||||
with:
|
|
||||||
issue-number: ${{ github.event.pull_request.number }}
|
|
||||||
comment-author: 'github-actions[bot]'
|
|
||||||
body-includes: You can download the generated screenshots from the workflow artifacts.
|
|
||||||
|
|
||||||
- name: Create comment
|
|
||||||
if: steps.find-comment.outputs.comment-id == ''
|
|
||||||
uses: peter-evans/create-or-update-comment@v3
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
issue-number: ${{ github.event.pull_request.number }}
|
|
||||||
body: |
|
|
||||||
🖼️ **Screenshots created**
|
|
||||||
|
|
||||||
You can download the generated screenshots from the workflow artifacts.
|
|
||||||
|
|
||||||
_Please note that artifacts are only available for download for ${{ github.retention_days }} days._
|
|
||||||
|
|
||||||
- Generated screenshots for ${{ github.event.pull_request.head.sha }} at ${{ steps.generate-screenshots.outputs.date }} ([download](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})).
|
|
||||||
|
|
||||||
- name: Update comment
|
|
||||||
if: steps.find-comment.outputs.comment-id != ''
|
|
||||||
uses: peter-evans/create-or-update-comment@v3
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
comment-id: ${{ steps.find-comment.outputs.comment-id }}
|
|
||||||
body: |
|
|
||||||
- Generated screenshots for ${{ github.event.pull_request.head.sha }} at ${{ steps.generate-screenshots.outputs.date }} ([download](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})).
|
|
||||||
|
|
Loading…
Reference in New Issue