Skip to content

Commit b0d34f8

Browse files
committed
fix the bug of coverage-upload
1 parent 12174e5 commit b0d34f8

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

.github/workflows/coverage-update-baseline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
fetch-depth: 0
7373

7474
- name: Download coverage artifacts
75-
uses: actions/download-artifact@v6
75+
uses: actions/download-artifact@v7
7676
with:
7777
name: base-jacoco-xml
7878
path: coverage-artifacts

.github/workflows/coverage-upload.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
persist-credentials: false
3131

3232
- name: Download coverage artifact
33-
uses: actions/download-artifact@v6
33+
uses: actions/download-artifact@v7
3434
with:
3535
name: jacoco-coverage
3636
path: coverage
@@ -43,13 +43,16 @@ jobs:
4343
with:
4444
script: |
4545
const headSha = context.payload.workflow_run.head_sha;
46-
const { data: pulls } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
46+
const headOwner = context.payload.workflow_run.head_repository.owner.login;
47+
const headBranch = context.payload.workflow_run.head_branch;
48+
const { data: pulls } = await github.rest.pulls.list({
4749
owner: context.repo.owner,
4850
repo: context.repo.repo,
49-
commit_sha: headSha,
51+
state: 'all',
52+
head: `${headOwner}:${headBranch}`,
5053
});
51-
if (pulls.length > 0) {
52-
const pr = pulls[0];
54+
const pr = pulls.find((p) => p.head.sha === headSha);
55+
if (pr) {
5356
core.setOutput('pr_number', pr.number);
5457
core.setOutput('pr_sha', headSha);
5558
core.setOutput('pr_branch', headBranch);

0 commit comments

Comments
 (0)