From 282fb9ad52b9f45e16903437e77bfb74e35add42 Mon Sep 17 00:00:00 2001 From: Shadow Date: Thu, 12 Feb 2026 14:58:25 -0600 Subject: [PATCH] CI: handle search 422 in labeler --- .github/workflows/labeler.yml | 54 +++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 264fd74aef..2bae5a6116 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -164,11 +164,19 @@ jobs: } const mergedQuery = `repo:${repo} is:pr is:merged author:${login}`; - const merged = await github.rest.search.issuesAndPullRequests({ - q: mergedQuery, - per_page: 1, - }); - const mergedCount = merged?.data?.total_count ?? 0; + let mergedCount = 0; + try { + const merged = await github.rest.search.issuesAndPullRequests({ + q: mergedQuery, + per_page: 1, + }); + mergedCount = merged?.data?.total_count ?? 0; + } catch (error) { + if (error?.status !== 422) { + throw error; + } + core.warning(`Skipping merged search for ${login}; treating as 0.`); + } if (mergedCount >= experiencedThreshold) { await github.rest.issues.addLabels({ @@ -273,11 +281,19 @@ jobs: } const mergedQuery = `repo:${repoFull} is:pr is:merged author:${login}`; - const merged = await github.rest.search.issuesAndPullRequests({ - q: mergedQuery, - per_page: 1, - }); - const mergedCount = merged?.data?.total_count ?? 0; + let mergedCount = 0; + try { + const merged = await github.rest.search.issuesAndPullRequests({ + q: mergedQuery, + per_page: 1, + }); + mergedCount = merged?.data?.total_count ?? 0; + } catch (error) { + if (error?.status !== 422) { + throw error; + } + core.warning(`Skipping merged search for ${login}; treating as 0.`); + } let label = null; if (mergedCount >= experiencedThreshold) { @@ -471,11 +487,19 @@ jobs: } const mergedQuery = `repo:${repo} is:pr is:merged author:${login}`; - const merged = await github.rest.search.issuesAndPullRequests({ - q: mergedQuery, - per_page: 1, - }); - const mergedCount = merged?.data?.total_count ?? 0; + let mergedCount = 0; + try { + const merged = await github.rest.search.issuesAndPullRequests({ + q: mergedQuery, + per_page: 1, + }); + mergedCount = merged?.data?.total_count ?? 0; + } catch (error) { + if (error?.status !== 422) { + throw error; + } + core.warning(`Skipping merged search for ${login}; treating as 0.`); + } if (mergedCount >= experiencedThreshold) { await github.rest.issues.addLabels({