Skip to content

Commit 0250bfe

Browse files
committed
trigger-workflow-dispatch: accommodate for clock skew
Seems as if the date we get in the response when creating a workflow dispatch _might_ be at, or after, the date the corresponding workflow run is created. Most likely explanation: clock skew. Let's allow for that. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent e8f7d09 commit 0250bfe

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

GitForWindowsHelper/trigger-workflow-dispatch.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ const triggerWorkflowDispatch = async (context, token, owner, repo, workflow_id,
4747
{ ref, inputs }
4848
)
4949

50-
const runs = await waitForWorkflowRun(context, owner, repo, workflow_id, new Date(date).toISOString(), token)
50+
// to avoid any potential clock skew, we set the "after" time to 5 seconds before the current time
51+
const after = new Date(Date.parse(date) - 5000).toISOString()
52+
const runs = await waitForWorkflowRun(context, owner, repo, workflow_id, after, token)
5153
return runs[0]
5254
}
5355

0 commit comments

Comments
 (0)