GitHub Actionsのinputが設定されてない時のcore.getInput()の戻りは「""」(空文字列)になる
以下のような検証コードを書いた。
code:ts
import * as core from '@actions/core'
...
const productionBranch = core.getInput('production-branch')
core.debug(productionBranch: ${JSON.stringify(productionBranch)})
出力は以下のように""になった。JSON.stringify()を使った結果なので文字列リテラルの表現で出力される。
https://gyazo.com/b84832bc3e7bef89ae03e239621c1a11
getInput()は型定義でもstringを返しており、この型定義は正しく、undefinedが混ざらないことが分かる。
code:core.d.ts
export declare function getInput(name: string, options?: InputOptions): string;