From 0144599a62068d960d053e3d446dcedbaa230b51 Mon Sep 17 00:00:00 2001 From: Megane Millan Date: Tue, 15 Oct 2024 09:06:03 +0200 Subject: [PATCH] [ci] Make sure scheduled workflow run with build_all --- .../scripts/get_compilation_flags.js | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/.github/workflows/scripts/get_compilation_flags.js b/.github/workflows/scripts/get_compilation_flags.js index 2eb0f044e4..fcfc1097c9 100644 --- a/.github/workflows/scripts/get_compilation_flags.js +++ b/.github/workflows/scripts/get_compilation_flags.js @@ -9,22 +9,8 @@ module.exports = async ({github, context, core}) => { const prNumber = context.issue.number || getPullRequestNumber(context.ref); - let cmakeFlags = ''; - if(isNaN(prNumber)) - { - core.setOutput("cmakeFlags", cmakeFlags); - return; - } - - const { data } = await github.rest.pulls.get({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: prNumber, - }); - const labelNames = data.labels.map(label => label.name); - + let cmakeFlags = '';// get os process is run on const os = process.env.RUNNER_OS; - var labelFlags; if(os == "Windows") { @@ -77,6 +63,29 @@ module.exports = async ({github, context, core}) => { }; } + // Get the GitHub event name that triggered the workflow + const eventName = process.env.GITHUB_EVENT_NAME; + if (eventName === "schedule") + { + cmakeFlags += labelFlags['build_all'].join(' '); + console.log(cmakeFlags); + core.setOutput("cmakeFlags", cmakeFlags); + return; + } + + if(isNaN(prNumber)) + { + core.setOutput("cmakeFlags", cmakeFlags); + return; + } + + const { data } = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber, + }); + const labelNames = data.labels.map(label => label.name); + labelNames.forEach(label => { if (labelFlags[label]) { if (Array.isArray(labelFlags[label])) {