diff --git a/.github/actions/ci-success/lib/monitor.mjs b/.github/actions/ci-success/lib/monitor.mjs index 3b7f56c..e87178d 100644 --- a/.github/actions/ci-success/lib/monitor.mjs +++ b/.github/actions/ci-success/lib/monitor.mjs @@ -49,8 +49,9 @@ function compileIgnorePatterns(patterns) { } function getInput(env, name, defaultValue) { - const key = `INPUT_${name.replace(/ /gu, '_').replace(/-/gu, '_').toUpperCase()}`; - const value = env[key]; + const normalizedKey = `INPUT_${name.replace(/ /gu, '_').replace(/-/gu, '_').toUpperCase()}`; + const rawKey = `INPUT_${name.replace(/ /gu, '_').toUpperCase()}`; + const value = env[normalizedKey] ?? env[rawKey]; return value == null || value === '' ? defaultValue : value; } diff --git a/.github/actions/ci-success/test/monitor.test.mjs b/.github/actions/ci-success/test/monitor.test.mjs index 9a52190..d0631ac 100644 --- a/.github/actions/ci-success/test/monitor.test.mjs +++ b/.github/actions/ci-success/test/monitor.test.mjs @@ -39,6 +39,14 @@ test('buildOptions reads inputs from the provided environment', () => { assert.equal(options.timeoutMs, 15_000); }); +test('buildOptions supports hyphenated action input keys from GitHub runtime', () => { + const options = buildOptions({ + 'INPUT_GITHUB-TOKEN': 'hyphen-token', + }); + + assert.equal(options.githubToken, 'hyphen-token'); +}); + test('evaluateObservedChecks fails when any completed check fails', () => { const result = evaluateObservedChecks( [