Skip to content

Commit e9a6907

Browse files
authored
Add debug logs for removeBackportLabelsFromPrs (#138)
From the logs: ```log 2024-10-19 15:52:16.292 error: Uncaught (in promise) Error: removeBackportLabelsFromPrs called with undefined 2024-10-19 15:52:16.292 throw new Error("removeBackportLabelsFromPrs called with undefined"); 2024-10-19 15:52:16.292 ^ 2024-10-19 15:52:16.292 at removeBackportLabelsFromPrs (file:///app/src/labels.ts:83:11) 2024-10-19 15:52:16.292 at file:///app/src/labels.ts:76:12 2024-10-19 15:52:16.292 at eventLoopTick (ext:core/01_core.js:175:7) 2024-10-19 15:52:16.292 at async Promise.all (index 1) 2024-10-19 15:52:16.292 at async Promise.all (index 1) 2024-10-19 15:52:16.292 at async Function.maintain (file:///app/src/labels.ts:26:3) ``` Signed-off-by: Yarden Shoham <[email protected]>
1 parent b1b4113 commit e9a6907

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/github.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { lt, parse, valid } from "@std/semver";
22
import { getPrBranchName } from "./git.ts";
33
import { GiteaVersion } from "./giteaVersion.ts";
44
import { backportPrExistsCache } from "./state.ts";
5+
import { PullRequest } from "./types.ts";
56

67
const GITHUB_API = "https://api.github.com";
78
const HEADERS = {
@@ -85,7 +86,9 @@ export const fetchPendingMerge = async () => {
8586
};
8687

8788
// returns a list of PRs that target the given branch
88-
export const fetchTargeting = async (branch: string) => {
89+
export const fetchTargeting = async (
90+
branch: string,
91+
): Promise<{ items: PullRequest[] }> => {
8992
const response = await fetch(
9093
`${GITHUB_API}/search/issues?q=` +
9194
encodeURIComponent(

src/labels.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ export const removeBackportLabelsFromPrsTargetingReleaseBranches = async () => {
7272
// versions
7373
return Promise.all(giteaVersions.map(async (version) => {
7474
const prs = await fetchTargeting(`release/v${version.majorMinorVersion}`);
75+
console.info(
76+
`Removing backport/* labels from PRs targeting v${version.majorMinorVersion}. The raw response from GitHub is:`,
77+
);
78+
console.info(JSON.stringify(prs));
7579
// PRs
7680
return removeBackportLabelsFromPrs(prs.items);
7781
}));

0 commit comments

Comments
 (0)