MCPcopy
hub / github.com/openclaw/clawsweeper / dispatchCommitFinding

Function dispatchCommitFinding

src/commit-sweeper.ts:809–844  ·  view source on GitHub ↗
(options: {
  dispatch: CommitFindingDispatch;
  mode: string;
  reportRepo: string;
  repairRepo: string;
  workflow: string;
})

Source from the content-addressed store, hash-verified

807}
808
809function dispatchCommitFinding(options: {
810 dispatch: CommitFindingDispatch;
811 mode: string;
812 reportRepo: string;
813 repairRepo: string;
814 workflow: string;
815}): void {
816 const commandArgs =
817 options.mode === "repository_dispatch"
818 ? ["api", `repos/${options.repairRepo}/dispatches`, "--method", "POST", "--input", "-"]
819 : workflowDispatchArgs(options.dispatch, options.reportRepo, options.workflow).map((arg) =>
820 arg === "PLACEHOLDER" ? options.repairRepo : arg,
821 );
822 const maxAttempts = 3;
823 for (let attempt = 0; attempt < maxAttempts; attempt++) {
824 const result = spawnSync("gh", commandArgs, {
825 input:
826 options.mode === "repository_dispatch"
827 ? dispatchPayload(options.dispatch, options.reportRepo)
828 : undefined,
829 encoding: "utf8",
830 env: process.env,
831 });
832 if (result.status === 0) return;
833
834 const error = dispatchFailureError(options, result);
835 const retryKind = ghRetryKind(error);
836 if (attempt >= maxAttempts - 1 || retryKind === "none") throw error;
837
838 const waitMs = ghRetryWaitMs(retryKind, attempt);
839 console.warn(
840 `dispatch failed with ${retryKind} GitHub error; retrying in ${Math.round(waitMs / 1000)}s`,
841 );
842 sleepSync(waitMs);
843 }
844}
845
846function dispatchFindingsCommand(args: Args): void {
847 const enabled = argString(args, "enabled", "true");

Callers 1

dispatchFindingsCommandFunction · 0.85

Calls 6

dispatchPayloadFunction · 0.85
dispatchFailureErrorFunction · 0.85
ghRetryKindFunction · 0.85
ghRetryWaitMsFunction · 0.85
sleepSyncFunction · 0.85
workflowDispatchArgsFunction · 0.70

Tested by

no test coverage detected