Skip to content

Commit 0122b85

Browse files
comment on PR when example job finds changes (#18064)
# Objective - Comment on PR when getting a rendering change ## Solution - When something changes in the rendering check CI, add a comment on the PR to check the results - Suggest adding the label `S-Deliberate-Rendering-Change` if it's expected - Don't comment if the label is already present --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
1 parent 058497e commit 0122b85

File tree

1 file changed

+36
-5
lines changed

1 file changed

+36
-5
lines changed

.github/workflows/example-run-report.yml

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
timeout-minutes: 30
2121
outputs:
2222
branch-name: ${{ steps.branch-name.outputs.result }}
23+
pr-number: ${{ steps.pr-number.outputs.result }}
2324
steps:
2425
- name: "Download artifact"
2526
id: find-artifact
@@ -59,11 +60,11 @@ jobs:
5960
- name: branch name
6061
id: branch-name
6162
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
6768
6869
compare-macos-screenshots:
6970
name: Compare macOS screenshots
@@ -75,3 +76,33 @@ jobs:
7576
artifact: screenshots-macos
7677
os: macos
7778
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

Comments
 (0)