@@ -40,6 +40,11 @@ export interface ActionConfig {
4040 * Time until giving up on identifying the Run ID.
4141 */
4242 workflowTimeoutSeconds : number ;
43+
44+ /**
45+ * Specify a static ID to use instead of a distinct ID.
46+ */
47+ distinctId ?: string ;
4348}
4449
4550type ActionWorkflowInputs = Record < string , string | number | boolean > ;
@@ -55,11 +60,14 @@ export function getConfig(): ActionConfig {
5560 ref : core . getInput ( "ref" , { required : true } ) ,
5661 repo : core . getInput ( "repo" , { required : true } ) ,
5762 owner : core . getInput ( "owner" , { required : true } ) ,
58- workflow : getWorkflowValue ( core . getInput ( "workflow" , { required : true } ) ) ,
63+ workflow : getWorkflowValueAsNumber (
64+ core . getInput ( "workflow" , { required : true } ) ,
65+ ) ,
5966 workflowInputs : getWorkflowInputs ( core . getInput ( "workflow_inputs" ) ) ,
6067 workflowTimeoutSeconds :
6168 getNumberFromValue ( core . getInput ( "workflow_timeout_seconds" ) ) ??
6269 WORKFLOW_TIMEOUT_SECONDS ,
70+ distinctId : getOptionalWorkflowValue ( core . getInput ( "distinct_id" ) ) ,
6371 } ;
6472}
6573
@@ -111,7 +119,7 @@ function getWorkflowInputs(
111119 }
112120}
113121
114- function getWorkflowValue ( workflowInput : string ) : string | number {
122+ function getWorkflowValueAsNumber ( workflowInput : string ) : string | number {
115123 try {
116124 // We can assume that the string is defined and not empty at this point.
117125 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -121,3 +129,10 @@ function getWorkflowValue(workflowInput: string): string | number {
121129 return workflowInput ;
122130 }
123131}
132+
133+ /**
134+ * We want empty strings to simply be undefined.
135+ */
136+ function getOptionalWorkflowValue ( workflowInput : string ) : string | undefined {
137+ return workflowInput || undefined ;
138+ }
0 commit comments