|
20 | 20 | timeout-minutes: 30
|
21 | 21 | outputs:
|
22 | 22 | branch-name: ${{ steps.branch-name.outputs.result }}
|
| 23 | + pr-number: ${{ steps.pr-number.outputs.result }} |
23 | 24 | steps:
|
24 | 25 | - name: "Download artifact"
|
25 | 26 | id: find-artifact
|
@@ -59,11 +60,11 @@ jobs:
|
59 | 60 | - name: branch name
|
60 | 61 | id: branch-name
|
61 | 62 | run: |
|
62 |
| - if [ -f PR ]; then |
63 |
| - echo "result=PR-$(cat PR)-${{ github.event.workflow_run.head_branch }}" >> $GITHUB_OUTPUT |
64 |
| - else |
65 |
| - echo "result=${{ github.event.workflow_run.head_branch }}" >> $GITHUB_OUTPUT |
66 |
| - fi |
| 63 | + echo "result=PR-$(cat PR)-${{ github.event.workflow_run.head_branch }}" >> $GITHUB_OUTPUT |
| 64 | + - name: PR number |
| 65 | + id: pr-number |
| 66 | + run: | |
| 67 | + echo "result=$(cat PR)" >> $GITHUB_OUTPUT |
67 | 68 |
|
68 | 69 | compare-macos-screenshots:
|
69 | 70 | name: Compare macOS screenshots
|
|
75 | 76 | artifact: screenshots-macos
|
76 | 77 | os: macos
|
77 | 78 | secrets: inherit
|
| 79 | + |
| 80 | + comment-on-pr: |
| 81 | + name: Comment on PR |
| 82 | + runs-on: ubuntu-latest |
| 83 | + needs: [make-macos-screenshots-available, compare-macos-screenshots] |
| 84 | + if: ${{ always() && needs.compare-macos-screenshots.result == 'failure' }} |
| 85 | + steps: |
| 86 | + - uses: actions/checkout@v4 |
| 87 | + - name: "Check if PR already has label" |
| 88 | + id: check-label |
| 89 | + env: |
| 90 | + PR: ${{ needs.make-macos-screenshots-available.outputs.pr-number }} |
| 91 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 92 | + run: | |
| 93 | + if [[ `gh api --jq '.labels.[].name' /repos/bevyengine/bevy/pulls/$PR` =~ "S-Rendering-Change" ]] |
| 94 | + then |
| 95 | + echo "result=true" >> $GITHUB_OUTPUT |
| 96 | + else |
| 97 | + echo "result=false" >> $GITHUB_OUTPUT |
| 98 | + fi |
| 99 | + - name: "Comment on PR" |
| 100 | + if: ${{ steps.check-label.outputs.result == 'false' }} |
| 101 | + env: |
| 102 | + PROJECT: B04F67C0-C054-4A6F-92EC-F599FEC2FD1D |
| 103 | + PR: ${{ needs.make-macos-screenshots-available.outputs.pr-number }} |
| 104 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 105 | + run: | |
| 106 | + LF=$'\n' |
| 107 | + COMMENT_BODY="Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke! ${LF}You can review it at https://pixel-eagle.com/project/$PROJECT?filter=PR-$PR ${LF} ${LF}If it's expected, please add the S-Deliberate-Rendering-Change label." |
| 108 | + gh issue comment $PR --body "$COMMENT_BODY" |
0 commit comments