Skip to content

Commit 96e779d

Browse files
committed
feat: avoid reconstructing the Date instance
1 parent 496dd66 commit 96e779d

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

dist/index.mjs

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,15 @@ export async function fetchWorkflowRunUrl(runId: number): Promise<string> {
158158
export async function fetchWorkflowRunIds(
159159
workflowId: number,
160160
branch: BranchNameResult,
161-
startTime: number,
161+
startTimeISO: string,
162162
): Promise<number[]> {
163163
try {
164164
const useBranchFilter =
165165
!branch.isTag &&
166166
branch.branchName !== undefined &&
167167
branch.branchName !== "";
168168

169-
const createdFrom = ">=" + new Date(startTime).toISOString();
169+
const createdFrom = `>=${startTimeISO}`;
170170

171171
// https://docs.github.com/en/rest/actions/workflow-runs#list-workflow-runs-for-a-repository
172172
const response = await octokit.rest.actions.listWorkflowRuns({

src/return-dispatch.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ export async function getRunIdAndUrl({
139139
workflowTimeoutMs,
140140
workflowJobStepsRetryMs,
141141
}: GetRunIdAndUrlOpts): Promise<Result<{ id: number; url: string }>> {
142+
const startTimeISO = new Date(startTime).toISOString();
142143
const retryTimeout = Math.max(
143144
constants.WORKFLOW_FETCH_TIMEOUT_MS,
144145
workflowTimeoutMs,
@@ -151,7 +152,7 @@ export async function getRunIdAndUrl({
151152

152153
// Get all runs for a given workflow ID
153154
const fetchWorkflowRunIds = await api.retryOrTimeout(
154-
() => api.fetchWorkflowRunIds(workflowId, branch, startTime),
155+
() => api.fetchWorkflowRunIds(workflowId, branch, startTimeISO),
155156
retryTimeout,
156157
);
157158
if (!fetchWorkflowRunIds.success) {

0 commit comments

Comments
 (0)