11name : Plugin Live Check
22
33on :
4- pull_request_target :
4+ pull_request :
55 branches : [master]
66 workflow_dispatch :
77 inputs :
1111 type : string
1212
1313concurrency :
14- group : ${{ github.workflow }}-${{ github.event.pull_request.number || github. ref }}
14+ group : ${{ github.workflow }}-${{ github.ref }}
1515 cancel-in-progress : true
1616
17- permissions : {}
18-
1917jobs :
2018 live-check :
2119 name : Plugin Live Check
2220 runs-on : ubuntu-latest
2321
24- outputs :
25- should_comment : ${{ steps.comment-artifact.outputs.should_comment }}
26-
2722 permissions :
2823 contents : read
2924
3025 steps :
31- - name : Checkout PR Merge Commit
32- if : github.event_name == 'pull_request_target'
33- uses : actions/checkout@v4
34- with :
35- ref : refs/pull/${{ github.event.pull_request.number }}/merge
36- fetch-depth : 0
37-
3826 - name : Checkout Repository
39- if : github.event_name == 'workflow_dispatch'
4027 uses : actions/checkout@v4
4128 with :
4229 fetch-depth : 0
4330
4431 - name : Get Changed Plugin Files
4532 id : changed-files
46- if : github.event_name == 'pull_request_target '
33+ if : github.event_name == 'pull_request '
4734 uses : tj-actions/changed-files@v45
4835 with :
4936 files : |
6754 uses : actions/setup-node@v4
6855 with :
6956 node-version : ' 20'
70- # Avoid writing contributor-controlled caches in the base branch's
71- # cache scope when running under pull_request_target.
72- cache : ${{ github.event_name == 'workflow_dispatch' && 'npm' || '' }}
57+ cache : ' npm'
7358
7459 - name : Install Dependencies
7560 if : steps.targets.outputs.files != ''
@@ -86,50 +71,10 @@ jobs:
8671 node scripts/live-check-plugin.js ${{ steps.targets.outputs.files }} > live-check-output.txt 2>&1
8772 echo "exit_code=$?" >> "$GITHUB_OUTPUT"
8873 cat live-check-output.txt
89-
90- - name : Prepare PR Comment Artifact
91- id : comment-artifact
92- if : always() && github.event_name == 'pull_request_target'
93- run : |
94- if [ "${{ steps.changed-files.outputs.any_changed }}" = 'true' ] && [ -f live-check-output.txt ]; then
95- echo 'should_comment=true' >> "$GITHUB_OUTPUT"
96- else
97- echo 'should_comment=false' >> "$GITHUB_OUTPUT"
98- fi
99-
100- - name : Upload PR Comment Artifact
101- if : always() && steps.comment-artifact.outputs.should_comment == 'true'
102- uses : actions/upload-artifact@v4
103- with :
104- name : plugin-live-check-comment
105- path : live-check-output.txt
106- retention-days : 1
74+ cat live-check-output.txt >> "$GITHUB_STEP_SUMMARY"
10775
10876 - name : Fail On Real Errors
10977 if : steps.targets.outputs.files != '' && steps.live-check.outputs.exit_code != '0'
11078 run : |
111- echo "Live check reported at least one FAIL — see the job log or PR comment above ."
79+ echo "Live check reported at least one FAIL — see the job log or workflow summary ."
11280 exit 1
113-
114- comment :
115- name : Post PR Comment
116- needs : live-check
117- if : always() && github.event_name == 'pull_request_target' && needs.live-check.outputs.should_comment == 'true'
118- runs-on : ubuntu-latest
119-
120- permissions :
121- actions : read
122- pull-requests : write
123-
124- steps :
125- - name : Download PR Comment Artifact
126- uses : actions/download-artifact@v4
127- with :
128- name : plugin-live-check-comment
129-
130- - name : Post PR Comment
131- uses : marocchino/sticky-pull-request-comment@v3
132- with :
133- number : ${{ github.event.pull_request.number }}
134- header : plugin-live-check
135- path : live-check-output.txt
0 commit comments