Skip to content

Commit 081e02b

Browse files
authored
Merge pull request #56 from 0xbigapple/hotfix/ci_2
ci: fix the bug of pr-cancel and Autobuild
2 parents 0509ea0 + b0d34f8 commit 081e02b

4 files changed

Lines changed: 20 additions & 10 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,16 @@ jobs:
3636
uses: github/codeql-action/init@v4
3737
with:
3838
languages: ${{ matrix.language }}
39+
build-mode: manual
3940

40-
- name: Autobuild
41-
uses: github/codeql-action/autobuild@v4
41+
- name: Set up JDK 8
42+
uses: actions/setup-java@v5
43+
with:
44+
java-version: '8'
45+
distribution: 'temurin'
46+
47+
- name: Build
48+
run: ./gradlew build -x test --no-daemon
4249

4350
- name: Perform CodeQL Analysis
4451
uses: github/codeql-action/analyze@v4

.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);

.github/workflows/pr-cancel.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
uses: actions/github-script@v8
1717
with:
1818
script: |
19-
const workflows = ['pr-build.yml', 'system-test.yml'];
19+
const workflows = ['pr-build.yml', 'system-test.yml', 'codeql.yml', 'coverage-waiting.yml'];
2020
const headSha = context.payload.pull_request.head.sha;
2121
const prNumber = context.payload.pull_request.number;
2222
@@ -36,7 +36,7 @@ jobs:
3636
);
3737
3838
for (const run of runs) {
39-
const isTargetPr = run.pull_requests?.some((pr) => pr.number === prNumber);
39+
const isTargetPr = !run.pull_requests?.length || run.pull_requests.some((pr) => pr.number === prNumber);
4040
if (run.head_sha === headSha && isTargetPr) {
4141
await github.rest.actions.cancelWorkflowRun({
4242
owner: context.repo.owner,

0 commit comments

Comments
 (0)