Skip to content

Commit 001d816

Browse files
committed
refactor: Request users to open issues if they encounter an unhandled status
1 parent 0759afb commit 001d816

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/await-remote-run.spec.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
import * as api from "./api.ts";
1414
import {
1515
getWorkflowRunConclusionResult,
16+
getWorkflowRunResult,
1617
getWorkflowRunStatusResult,
1718
handleActionFail,
1819
} from "./await-remote-run.ts";
@@ -105,11 +106,15 @@ describe("await-remote-run", () => {
105106
expect(result.reason).toStrictEqual("unsupported");
106107

107108
// Logging
108-
assertOnlyCalled(coreDebugLogMock);
109-
expect(coreDebugLogMock).toHaveBeenCalledOnce();
110-
expect(coreDebugLogMock.mock.lastCall?.[0]).toStrictEqual(
109+
assertOnlyCalled(coreErrorLogMock, coreInfoLogMock);
110+
expect(coreErrorLogMock).toHaveBeenCalledOnce();
111+
expect(coreErrorLogMock.mock.lastCall?.[0]).toStrictEqual(
111112
`Run status is unsupported: ${status}`,
112113
);
114+
expect(coreInfoLogMock).toHaveBeenCalledOnce();
115+
expect(coreInfoLogMock.mock.lastCall?.[0]).toStrictEqual(
116+
"Please open an issue with this status value",
117+
);
113118
});
114119
});
115120

src/await-remote-run.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ export function getWorkflowRunStatusResult(
3030
return { success: false, reason: "pending", value: status };
3131
}
3232

33-
core.debug(`Run status is unsupported: ${status}`);
33+
core.error(`Run status is unsupported: ${status}`);
34+
core.info("Please open an issue with this status value");
3435
return { success: false, reason: "unsupported", value: status ?? "null" };
3536
}
3637

src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ export enum WorkflowRunConclusion {
2525
ActionRequired = "action_required",
2626
}
2727

28-
export type Result<T> = ResultSuccess<T> | ResultFailure | ResultUnsupported;
28+
export type Result<T> = ResultSuccess<T> | RequestTimeout | ResultUnsupported;
2929

3030
interface ResultSuccess<T> {
3131
success: true;
3232
value: T;
3333
}
3434

35-
interface ResultFailure {
35+
interface RequestTimeout {
3636
success: false;
3737
reason: "timeout";
3838
}

0 commit comments

Comments
 (0)