Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent duplicate issues on GitHub reports #1111

Merged
merged 6 commits into from
Oct 22, 2024

Conversation

Ndpnt
Copy link
Member

@Ndpnt Ndpnt commented Oct 21, 2024

No description provided.

@Ndpnt Ndpnt requested a review from MattiSG October 21, 2024 13:43
@Ndpnt Ndpnt force-pushed the avoid-duplicate-issues-on-git-hub-reports branch from 337b6a2 to aa3b7f5 Compare October 21, 2024 14:19
Nock versions < 14 cannot mock native `fetch` requests used by Octokit > 2.0.2. However, Nock 14.0.0-beta.15 can handle these requests.
This serves as a temporary fix until Nock v14 is officially released.
@Ndpnt Ndpnt force-pushed the avoid-duplicate-issues-on-git-hub-reports branch from 88b6ab4 to 88d3771 Compare October 21, 2024 15:56
}
} catch (error) {
logger.error(`🤖 Failed to handle repository labels: ${error.message}`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the point of this “robot” emoji in the logs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is just legacy


return this.closeIssue(openedIssue);
return logger.info(`🤖 Closed issue #${openedIssue.number}: ${openedIssue.html_url}`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we log this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it useful to log the changes made to the reported issues.

return this.closeIssue(openedIssue);
return logger.info(`🤖 Closed issue #${openedIssue.number}: ${openedIssue.html_url}`);
} catch (error) {
logger.error(`🤖 Failed to handle issue "${title}": ${error.message}`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logger.error(`🤖 Failed to handle issue "${title}": ${error.message}`);
logger.error(`Failed to update issue "${title}": ${error.message}`);

const [managedLabel] = issue.labels.filter(label => managedLabelsNames.includes(label.name)); // it is assumed that only one specific reason for failure is possible at a time, making managed labels mutually exclusive
if (issue.state == GitHub.ISSUE_STATE_CLOSED) {
await this.openIssue(issue);
logger.info(`🤖 Reopen issue #${issue.number}: ${issue.html_url}`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to log this?

Suggested change
logger.info(`🤖 Reopen issue #${issue.number}: ${issue.html_url}`);
logger.info(`Reopened issue #${issue.number}: ${issue.html_url}`);

await this.addCommentToIssue({ issue, comment: description });
logger.info(`🤖 Updated issue #${issue.number}: ${issue.html_url}`);
} catch (error) {
logger.error(`🤖 Failed to handle issue "${title}": ${error.message}`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logger.error(`🤖 Failed to handle issue "${title}": ${error.message}`);
logger.error(`Failed to update issue "${title}": ${error.message}`);

@Ndpnt Ndpnt merged commit 93508c6 into main Oct 22, 2024
8 checks passed
@Ndpnt Ndpnt deleted the avoid-duplicate-issues-on-git-hub-reports branch October 22, 2024 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants