mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 21:03:05 -07:00
fix(github): harden label-workstream-rollup with debug logs and case-insensitive check
This commit is contained in:
@@ -26,7 +26,11 @@ jobs:
|
|||||||
'https://github.com/google-gemini/gemini-cli/issues/15324',
|
'https://github.com/google-gemini/gemini-cli/issues/15324',
|
||||||
'https://github.com/google-gemini/gemini-cli/issues/17202',
|
'https://github.com/google-gemini/gemini-cli/issues/17202',
|
||||||
'https://github.com/google-gemini/gemini-cli/issues/17203'
|
'https://github.com/google-gemini/gemini-cli/issues/17203'
|
||||||
];
|
].map(url => url.toLowerCase());
|
||||||
|
|
||||||
|
const headers = {
|
||||||
|
'GraphQL-Features': 'sub_issues'
|
||||||
|
};
|
||||||
|
|
||||||
// Single issue processing (for event triggers)
|
// Single issue processing (for event triggers)
|
||||||
async function processSingleIssue(owner, repo, number) {
|
async function processSingleIssue(owner, repo, number) {
|
||||||
@@ -55,7 +59,7 @@ jobs:
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
try {
|
try {
|
||||||
const result = await github.graphql(query, { owner, repo, number });
|
const result = await github.graphql(query, { owner, repo, number, headers });
|
||||||
|
|
||||||
if (!result || !result.repository || !result.repository.issue) {
|
if (!result || !result.repository || !result.repository.issue) {
|
||||||
console.log(`Issue #${number} not found or data missing.`);
|
console.log(`Issue #${number} not found or data missing.`);
|
||||||
@@ -66,7 +70,7 @@ jobs:
|
|||||||
await checkAndLabel(issue, owner, repo);
|
await checkAndLabel(issue, owner, repo);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Failed to process issue #${number}:`, error);
|
console.error(`Failed to process issue #${number}:`, error);
|
||||||
throw error; // Re-throw to be caught by main execution
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +112,7 @@ jobs:
|
|||||||
|
|
||||||
while (hasNextPage) {
|
while (hasNextPage) {
|
||||||
try {
|
try {
|
||||||
const result = await github.graphql(query, { owner, repo, cursor });
|
const result = await github.graphql(query, { owner, repo, cursor, headers });
|
||||||
|
|
||||||
if (!result || !result.repository || !result.repository.issues) {
|
if (!result || !result.repository || !result.repository.issues) {
|
||||||
console.error('Invalid response structure from GitHub API');
|
console.error('Invalid response structure from GitHub API');
|
||||||
@@ -126,7 +130,7 @@ jobs:
|
|||||||
cursor = result.repository.issues.pageInfo.endCursor;
|
cursor = result.repository.issues.pageInfo.endCursor;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to fetch issues batch:', error);
|
console.error('Failed to fetch issues batch:', error);
|
||||||
throw error; // Re-throw to be caught by main execution
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,10 +143,11 @@ jobs:
|
|||||||
let matched = false;
|
let matched = false;
|
||||||
|
|
||||||
while (currentParent) {
|
while (currentParent) {
|
||||||
tracedParents.push(currentParent.url);
|
const parentUrl = currentParent.url;
|
||||||
|
tracedParents.push(parentUrl);
|
||||||
|
|
||||||
if (allowedParentUrls.includes(currentParent.url)) {
|
if (allowedParentUrls.includes(parentUrl.toLowerCase())) {
|
||||||
console.log(`SUCCESS: Issue #${issue.number} is a descendant of ${currentParent.url}. Trace: ${tracedParents.join(' -> ')}. Adding label.`);
|
console.log(`SUCCESS: Issue #${issue.number} is a descendant of ${parentUrl}. Trace: ${tracedParents.join(' -> ')}. Adding label.`);
|
||||||
await github.rest.issues.addLabels({
|
await github.rest.issues.addLabels({
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
@@ -157,6 +162,9 @@ jobs:
|
|||||||
|
|
||||||
if (!matched && context.eventName === 'issues') {
|
if (!matched && context.eventName === 'issues') {
|
||||||
console.log(`Issue #${issue.number} did not match any allowed workstreams. Trace: ${tracedParents.join(' -> ') || 'None'}.`);
|
console.log(`Issue #${issue.number} did not match any allowed workstreams. Trace: ${tracedParents.join(' -> ') || 'None'}.`);
|
||||||
|
} else if (!matched) {
|
||||||
|
// Log for debug in bulk mode if it has a parent but didn't match
|
||||||
|
console.log(`Issue #${issue.number} has parents but did not match. Trace: ${tracedParents.join(' -> ')}.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user