@continuous-excellence/ze-great-dashboard-aws 0.18.2 → 0.18.3
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/dist/lambda.mjs +17 -5
- package/package.json +1 -1
package/dist/lambda.mjs
CHANGED
|
@@ -66641,11 +66641,12 @@ async function fetchGithubActionsPullRequestHealth(args) {
|
|
|
66641
66641
|
const source = githubActionsSourceSchema.parse(args.source);
|
|
66642
66642
|
try {
|
|
66643
66643
|
const workflowResults = await Promise.all(
|
|
66644
|
-
panel.update_workflows.map(async ({ workflow }) => ({
|
|
66644
|
+
panel.update_workflows.map(async ({ workflow, branch_prefixes }) => ({
|
|
66645
66645
|
workflow,
|
|
66646
66646
|
run: await latestRun({
|
|
66647
66647
|
source,
|
|
66648
66648
|
workflow,
|
|
66649
|
+
branchPrefixes: branch_prefixes,
|
|
66649
66650
|
requestHeaders: args.requestHeaders,
|
|
66650
66651
|
fetcher: args.fetcher,
|
|
66651
66652
|
githubClient: githubClientFor(args)
|
|
@@ -66718,11 +66719,22 @@ async function fetchGithubActionsPullRequestHealth(args) {
|
|
|
66718
66719
|
}
|
|
66719
66720
|
}
|
|
66720
66721
|
async function latestRun(args) {
|
|
66721
|
-
const call = githubRunsCall(
|
|
66722
|
+
const call = githubRunsCall(
|
|
66723
|
+
args.source,
|
|
66724
|
+
args.workflow,
|
|
66725
|
+
args.branch,
|
|
66726
|
+
args.event,
|
|
66727
|
+
args.branchPrefixes ? 100 : 1
|
|
66728
|
+
);
|
|
66722
66729
|
const response = await githubFetch(call, args);
|
|
66723
66730
|
if (!response.ok) throw new Error(`${response.status} ${response.statusText}`);
|
|
66724
66731
|
const runs = runsSchema.parse(await response.json()).workflow_runs;
|
|
66725
|
-
|
|
66732
|
+
const branchPrefixes = args.branchPrefixes;
|
|
66733
|
+
if (!branchPrefixes) return runs[0];
|
|
66734
|
+
return runs.find((run) => {
|
|
66735
|
+
const headBranch = run.head_branch;
|
|
66736
|
+
return headBranch !== void 0 && headBranch !== null && branchPrefixes.some((prefix) => headBranch.startsWith(prefix));
|
|
66737
|
+
});
|
|
66726
66738
|
}
|
|
66727
66739
|
async function openPullRequests(args) {
|
|
66728
66740
|
const result = [];
|
|
@@ -66743,13 +66755,13 @@ function pullRequestsCall(source, baseBranch, page) {
|
|
|
66743
66755
|
url2.searchParams.set("page", String(page));
|
|
66744
66756
|
return { url: url2.toString(), headers: new Headers() };
|
|
66745
66757
|
}
|
|
66746
|
-
function githubRunsCall(source, workflow, branch, event) {
|
|
66758
|
+
function githubRunsCall(source, workflow, branch, event, perPage = 1) {
|
|
66747
66759
|
const url2 = new URL(
|
|
66748
66760
|
`https://api.github.com/repos/${source.repo}/actions/workflows/${encodeURIComponent(workflow)}/runs`
|
|
66749
66761
|
);
|
|
66750
66762
|
if (branch) url2.searchParams.set("branch", branch);
|
|
66751
66763
|
if (event) url2.searchParams.set("event", event);
|
|
66752
|
-
url2.searchParams.set("per_page",
|
|
66764
|
+
url2.searchParams.set("per_page", String(perPage));
|
|
66753
66765
|
return { url: url2.toString(), headers: new Headers() };
|
|
66754
66766
|
}
|
|
66755
66767
|
function healthItem(label, run, detail, link) {
|