@@ -18,37 +18,32 @@ jobs:
1818 - uses : actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
1919 with :
2020 node-version : latest
21- - name : 🔍 Get PR number
22- id : pr
23- uses : actions/github-script@v8
24- with :
25- script : |
26- const pulls = await github.rest.repos.listPullRequestsAssociatedWithCommit({
27- owner: context.repo.owner,
28- repo: context.repo.repo,
29- commit_sha: context.payload.workflow_run.head_sha,
30- });
31-
32- if (pulls.data.length > 0) {
33- return pulls.data[0].number;
34- }
35- return null;
36-
21+
3722 - name : ⏬ Download artifacts from workflow run
38- if : steps.pr.outputs.result
39- uses : actions/download-artifact@v5
23+ uses : actions/download-artifact@v4
4024 with :
4125 github-token : ${{ secrets.GITHUB_TOKEN }}
4226 run-id : ${{ github.event.workflow_run.id }}
27+ path : .
28+
29+ - name : 🔍 Get PR number from artifact
30+ id : pr
31+ run : |
32+ if [ -f pr-number/pr-number.txt ]; then
33+ PR_NUMBER=$(cat pr-number/pr-number.txt)
34+ echo "result=$PR_NUMBER" >> $GITHUB_OUTPUT
35+ echo "Found PR number: $PR_NUMBER"
36+ else
37+ echo "PR number file not found"
38+ echo "result=" >> $GITHUB_OUTPUT
39+ fi
4340
4441 - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
45- if : steps.pr.outputs.result
4642 with :
4743 sparse-checkout : scripts/parse-sizes.ts
4844 sparse-checkout-cone-mode : false
4945
5046 - name : 📊 Generate size comparison
51- if : steps.pr.outputs.result
5247 id : sizes
5348 run : |
5449 COMMENT=$(node scripts/parse-sizes.ts nuxi nuxt-cli create-nuxt)
5752 echo "EOF" >> $GITHUB_OUTPUT
5853
5954 - name : 💬 Post or update comment
60- if : steps.pr.outputs.result
6155 uses : actions/github-script@v8
6256 with :
6357 script : |
@@ -77,23 +71,15 @@ jobs:
7771 );
7872
7973 if (botComment) {
80- // Update existing comment
74+ console.log(`Updating existing comment ${botComment.id}`);
8175 await github.rest.issues.updateComment({
8276 owner: context.repo.owner,
8377 repo: context.repo.repo,
8478 comment_id: botComment.id,
8579 body: commentBody
8680 });
8781 } else {
88- // Create new comment
89- await github.rest.issues.createComment({
90- owner: context.repo.owner,
91- repo: context.repo.repo,
92- issue_number: prNumber,
93- body: commentBody
94- });
95- } else {
96- // Create new comment
82+ console.log('Creating new comment');
9783 await github.rest.issues.createComment({
9884 owner: context.repo.owner,
9985 repo: context.repo.repo,
0 commit comments