From 3f2daa269fdebdca188cbfd0fcde949407a2c645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Nesveda?= Date: Mon, 18 May 2026 12:51:23 +0200 Subject: [PATCH] fix: Correctly pass inputs to `github-script` actions --- execute-workflow/action.yaml | 4 ++++ execute-workflow/index.mts | 6 +++--- wait-for-checks/action.yaml | 10 ++++++++++ wait-for-checks/index.mts | 18 +++++++++--------- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/execute-workflow/action.yaml b/execute-workflow/action.yaml index 78d4e17..5502daf 100644 --- a/execute-workflow/action.yaml +++ b/execute-workflow/action.yaml @@ -18,6 +18,9 @@ runs: steps: - name: Execute workflow uses: actions/github-script@v8 + env: + WORKFLOW: ${{ inputs.workflow }} + INPUTS: ${{ inputs.inputs }} with: github-token: ${{ inputs.token }} script: | @@ -27,4 +30,5 @@ runs: github, context, core, + env: process.env, }); diff --git a/execute-workflow/index.mts b/execute-workflow/index.mts index 1e67b26..16d5e20 100644 --- a/execute-workflow/index.mts +++ b/execute-workflow/index.mts @@ -18,12 +18,12 @@ type WorkflowRun = { html_url: string; }; -export async function main({ github, context, core }: { github: Octokit, context: typeof Context, core: typeof Core }) { +export async function main({ github, context, core, env }: { github: Octokit, context: typeof Context, core: typeof Core, env: Record }) { core.info(`🏃 Execute Workflow Action v${PackageJSON.version}`); try { - const workflowFileName = core.getInput('workflow'); + const workflowFileName = env.WORKFLOW ?? ''; - const inputsJson = core.getInput('inputs'); + const inputsJson = env.INPUTS ?? ''; const inputs = inputsJson ? JSON.parse(inputsJson) : {}; const { owner, repo } = context.repo; diff --git a/wait-for-checks/action.yaml b/wait-for-checks/action.yaml index 363f931..359fc0a 100644 --- a/wait-for-checks/action.yaml +++ b/wait-for-checks/action.yaml @@ -43,6 +43,15 @@ runs: steps: - name: Wait for checks uses: actions/github-script@v8 + env: + CHECK_NAME: ${{ inputs.check-name }} + CHECK_REGEXP: ${{ inputs.check-regexp }} + REF: ${{ inputs.ref }} + WAIT_INTERVAL: ${{ inputs.wait-interval }} + RUNNING_WORKFLOW_NAME: ${{ inputs.running-workflow-name }} + ALLOWED_CONCLUSIONS: ${{ inputs.allowed-conclusions }} + IGNORE_CHECKS: ${{ inputs.ignore-checks }} + VERBOSE: ${{ inputs.verbose }} with: github-token: ${{ inputs.token }} script: | @@ -52,4 +61,5 @@ runs: github, context, core, + env: process.env, }); diff --git a/wait-for-checks/index.mts b/wait-for-checks/index.mts index d245003..9ae5fc6 100644 --- a/wait-for-checks/index.mts +++ b/wait-for-checks/index.mts @@ -98,17 +98,17 @@ async function findCommitWithoutSkipCI( throw new Error(`Traversed ${MAX_PARENT_TRAVERSAL} commits without finding one without [skip ci]. Giving up.`); } -export async function main({ github, context, core }: { github: Octokit; context: typeof Context; core: typeof Core }) { +export async function main({ github, context, core, env }: { github: Octokit; context: typeof Context; core: typeof Core; env: Record }) { core.info(`🔍 Wait for Checks Action v${PackageJSON.version}`); try { - const checkName = core.getInput('check-name'); - const checkRegexp = core.getInput('check-regexp'); - const ref = core.getInput('ref'); - const waitInterval = parseInt(core.getInput('wait-interval'), 10); - const runningWorkflowName = core.getInput('running-workflow-name'); - const allowedConclusionsInput = core.getInput('allowed-conclusions'); - const ignoreChecksInput = core.getInput('ignore-checks'); - const verbose = core.getInput('verbose') === 'true'; + const checkName = env.CHECK_NAME ?? ''; + const checkRegexp = env.CHECK_REGEXP ?? ''; + const ref = env.REF ?? ''; + const waitInterval = parseInt(env.WAIT_INTERVAL ?? '10', 10); + const runningWorkflowName = env.RUNNING_WORKFLOW_NAME ?? ''; + const allowedConclusionsInput = env.ALLOWED_CONCLUSIONS ?? ''; + const ignoreChecksInput = env.IGNORE_CHECKS ?? ''; + const verbose = (env.VERBOSE ?? '') === 'true'; const allowedConclusions = allowedConclusionsInput.split(',').map((c) => c.trim()); const ignoreChecks = ignoreChecksInput