INNER CODE UNIT · TypeScript
unwrapProperty
cloudposse/atmos · .github/actions/stopwatch/src/index.ts:131
function unwrapProperty<T>(property: string): (response: unknown) => T[] {
return (response: unknown): T[] => {
if (typeof response !== "object" || response === null || !Array.isArray(Reflect.get(response, property))) {
throw new Error(`GitHub API response did not contain ${property}`);
}
return Reflect.get(response, property) as T[];
};
}
/** Collects completed PR workflow timings and publishes the sticky comment. */
async function run(): Promise<void> {
await setResult(false, "Action has not completed");
const token = getInput("github-token");
const workflowRunId = parseIntegerInput("workflow-run-id", 1);
const settleSeconds = parseIntegerInput("settle-seconds", 0, 120);
const marker = getInput("comment-marker");
const commentAuthor = getInput("comment-author");