@dsdenes/devboard 0.1.562 → 0.1.563
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/gitea.ts +31 -11
- package/package.json +1 -1
package/lib/gitea.ts
CHANGED
|
@@ -668,17 +668,7 @@ export async function giteaDeleteBranch(
|
|
|
668
668
|
}
|
|
669
669
|
|
|
670
670
|
/** Workflow runs whose triggering commit is `headSha`. */
|
|
671
|
-
|
|
672
|
-
target: GiteaTarget,
|
|
673
|
-
headSha: string,
|
|
674
|
-
fetchImpl: FetchLike = fetch,
|
|
675
|
-
): Promise<GiteaWorkflowRun[]> {
|
|
676
|
-
const document = await giteaJson<unknown>(
|
|
677
|
-
target,
|
|
678
|
-
`${repoPath(target)}/actions/runs?head_sha=${encodeURIComponent(headSha)}&limit=50`,
|
|
679
|
-
undefined,
|
|
680
|
-
fetchImpl,
|
|
681
|
-
);
|
|
671
|
+
function workflowRunsFrom(document: unknown): GiteaWorkflowRun[] {
|
|
682
672
|
let entries: unknown;
|
|
683
673
|
if (Array.isArray(document)) {
|
|
684
674
|
entries = document;
|
|
@@ -707,3 +697,33 @@ export async function giteaWorkflowRuns(
|
|
|
707
697
|
}
|
|
708
698
|
return runs;
|
|
709
699
|
}
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* Workflow runs for one commit. The run-list endpoint needs a credential on
|
|
703
|
+
* the canonical instance; the public task feed answers the same records, so
|
|
704
|
+
* read-only verification works without a token.
|
|
705
|
+
*/
|
|
706
|
+
export async function giteaWorkflowRuns(
|
|
707
|
+
target: GiteaTarget,
|
|
708
|
+
headSha: string,
|
|
709
|
+
fetchImpl: FetchLike = fetch,
|
|
710
|
+
): Promise<GiteaWorkflowRun[]> {
|
|
711
|
+
try {
|
|
712
|
+
const document = await giteaJson<unknown>(
|
|
713
|
+
target,
|
|
714
|
+
`${repoPath(target)}/actions/runs?head_sha=${encodeURIComponent(headSha)}&limit=50`,
|
|
715
|
+
undefined,
|
|
716
|
+
fetchImpl,
|
|
717
|
+
);
|
|
718
|
+
return workflowRunsFrom(document);
|
|
719
|
+
} catch (error) {
|
|
720
|
+
if (!(error instanceof GiteaError) || error.status !== 401) throw error;
|
|
721
|
+
const document = await giteaJson<unknown>(
|
|
722
|
+
target,
|
|
723
|
+
`${repoPath(target)}/actions/tasks?limit=50`,
|
|
724
|
+
undefined,
|
|
725
|
+
fetchImpl,
|
|
726
|
+
);
|
|
727
|
+
return workflowRunsFrom(document);
|
|
728
|
+
}
|
|
729
|
+
}
|