|
20 | 20 | uses: actions/github-script@v7 |
21 | 21 | with: |
22 | 22 | script: | |
23 | | - const prNumber = context.payload.pull_request.number; |
| 23 | + const prNumber = context.payload?.pull_request?.number || context.payload?.issue?.number; |
24 | 24 |
|
25 | 25 | // Get list of files changed in the PR |
26 | 26 | const { data: files } = await github.rest.pulls.listFiles({ |
|
29 | 29 | pull_number: prNumber, |
30 | 30 | }); |
31 | 31 |
|
| 32 | + let pullRequest = context.payload.pull_request; |
| 33 | +
|
| 34 | + if (!pullRequest) { |
| 35 | + // Fetch the pull request data |
| 36 | + const pullRequestData = await github.rest.pulls.get({ |
| 37 | + owner: context.repo.owner, |
| 38 | + repo: context.repo.repo, |
| 39 | + pull_number: prNumber, |
| 40 | + }); |
| 41 | + pullRequest = pullRequestData.data; |
| 42 | + } |
| 43 | +
|
32 | 44 | // Check if any changeset files indicate a major bump |
33 | 45 | let hasMajorChangeset = false; |
34 | 46 | for (const file of files) { |
|
38 | 50 | owner: context.repo.owner, |
39 | 51 | repo: context.repo.repo, |
40 | 52 | path: file.filename, |
41 | | - ref: context.payload.pull_request.head.sha, |
| 53 | + ref: pullRequest.head.sha, |
42 | 54 | }); |
43 | 55 |
|
44 | 56 | const content = Buffer.from(changesetContent.content, changesetContent.encoding).toString(); |
|
58 | 70 | uses: actions/github-script@v7 |
59 | 71 | with: |
60 | 72 | script: | |
61 | | - const prNumber = context.payload.pull_request.number; |
| 73 | + const prNumber = context.payload?.pull_request?.number || context.payload?.issue?.number; |
62 | 74 | const org = context.repo.owner; |
63 | 75 |
|
64 | 76 | // Get all comments on the PR |
|
0 commit comments