From 9f92d2ee00a42d11c145dad27d3d7dfa7766dc68 Mon Sep 17 00:00:00 2001 From: superzheng Date: Mon, 7 Nov 2022 16:17:19 +0800 Subject: [PATCH] fix(workflows): fix CodeQL languages detection bug on PR request --- .github/workflows/security_codeql_analyses.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/security_codeql_analyses.yml b/.github/workflows/security_codeql_analyses.yml index d4a4e636e..936bf7dd4 100644 --- a/.github/workflows/security_codeql_analyses.yml +++ b/.github/workflows/security_codeql_analyses.yml @@ -55,7 +55,7 @@ jobs: let has_hit = false; try { - await github.paginate(pulls.listFiles, { + const count = (await github.paginate(pulls.listFiles, { owner, repo, per_page: 100, @@ -69,9 +69,14 @@ jobs: } else { has_hit |= all_exts.includes(ext); } - return []; } - }); + return [files.length]; + })).reduce((a, b) => a + b, 0); + + if (count === 3_000) { // The paginated response include a maximum of 3000 files + console.log("::set-output name=language::${{ matrix.language }}"); // Fallback to all language + return; + } } catch (e) { console.error(e); console.log("::set-output name=language::${{ matrix.language }}"); // Fallback to all language