Skip to content

[code-simplifier] refactor(js): remove duplicate getDiscussionId, reuse getDiscussionNodeId - #42892

Merged
pelikhan merged 2 commits into
mainfrom
simplify/remove-duplicate-getdiscussionid-71a4ced1158b8298
Jul 2, 2026
Merged

[code-simplifier] refactor(js): remove duplicate getDiscussionId, reuse getDiscussionNodeId#42892
pelikhan merged 2 commits into
mainfrom
simplify/remove-duplicate-getdiscussionid-71a4ced1158b8298

Conversation

@github-actions

@github-actionsgithub-actionsBot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

Potential security threats were detected in the agent output.

Review the workflow run logs for details.

test body

Generated by PR Description Updater for #42892 · 68.8 AIC · ⌖ 7.22 AIC · ⊞ 4.7K ·

…deId from add_reaction
add_reaction_and_edit_comment.cjs defined a local getDiscussionId(owner, repo, num)
that returned {id, url} but only id was ever used. The equivalent getDiscussionNodeId
is already exported from ./add_reaction.cjs, which was already imported. Remove the
31-line duplicate and import getDiscussionNodeId directly.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review July 2, 2026 09:59
CopilotAI review requested due to automatic review settings July 2, 2026 09:59
@github-actions

github-actionsBot commented Jul 2, 2026

Copy link
Copy Markdown
ContributorAuthor

Test Quality Sentinel completed test quality analysis.

No test files were added or modified in this PR. Test Quality Sentinel skipped.

@github-actions

github-actionsBot commented Jul 2, 2026

Copy link
Copy Markdown
ContributorAuthor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR does not have the 'implementation' label and has ≤100 new lines of code in business logic directories (0 additions detected).

@github-actions

github-actionsBot commented Jul 2, 2026

Copy link
Copy Markdown
ContributorAuthor

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actionsBot commented Jul 2, 2026

Copy link
Copy Markdown
ContributorAuthor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Removes duplicate discussion node-ID lookup logic from actions/setup/js/add_reaction_and_edit_comment.cjs by reusing the already-exported getDiscussionNodeId helper from actions/setup/js/add_reaction.cjs, keeping discussion reaction/comment behavior the same while reducing duplicated GraphQL code.

Changes:

  • Imports getDiscussionNodeId from ./add_reaction.cjs and uses it for discussion node ID resolution.
  • Replaces prior getDiscussionId(...).id usage with the direct node ID string returned by getDiscussionNodeId(...).
  • Deletes the local getDiscussionId implementation (previously returning {id, url} when only id was used).
Show a summary per file
FileDescription
actions/setup/js/add_reaction_and_edit_comment.cjsReuses shared discussion node-ID helper and removes the duplicated local GraphQL lookup function.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Low

@github-actionsgithub-actionsBot left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Clean, behavior-preserving deduplication. Both call sites are correctly updated: discussion.id → direct string return, and { id: discussionId } destructuring → direct assignment. The removed url field from the old getDiscussionId return was dead (never consumed at any call site). Error handling, function signature, and module exports are all identical. No issues found.

🔎 Code quality review by PR Code Quality Reviewer · 24.5 AIC · ⌖ 6.96 AIC · ⊞ 1.6K
Comment /review to run again

@github-actionsgithub-actionsBot left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Review: Approved ✅

This is a clean, behavior-preserving refactor. Both call sites only consumed the .id field from the old getDiscussionId({id, url}) return value — the .url field was fetched but never used. The imported getDiscussionNodeId has an identical signature and error-handling path, making this a safe deduplication.

Verified:

  • Both original call sites only used .id (via discussion.id and { id: discussionId } destructuring)
  • getDiscussionNodeId in add_reaction.cjs has the same signature (owner, repo, num), the same GraphQL query structure, and the same ERR_NOT_FOUND error throw
  • module.exports of the modified file is unchanged
  • Net result: 31 lines removed, no behavior change

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · 19.9 AIC · ⌖ 6.92 AIC · ⊞ 4.9K

@github-actionsgithub-actionsBot left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · 53.6 AIC · ⌖ 9.56 AIC · ⊞ 6.6K
Comment /matt to run again

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address unresolved review comments, and rerun checks once the branch is up to date.

Generated by 👨‍🍳 PR Sous Chef · 8.92 AIC · ⌖ 16.3 AIC · ⊞ 6.4K ·

CopilotAI commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

@copilot please run the pr-finisher skill, address unresolved review comments, and rerun checks once the branch is up to date.

...

Done. Here's the summary:

  • Reviews — No unresolved review threads. All automated reviewers (Copilot PR Reviewer, Code Quality Reviewer, Impeccable Skills Reviewer) found no issues and approved the change.
  • Checks (local)make fmt, make lint, and make test-unit all pass cleanly.
  • Checks (CI) — stale after agent push; needs human re-trigger. No prior CI failures were found on the last run for the pre-merge commit.
  • Mergeable — PR is open, not draft, branch is up to date with main (merge commit already present).

Actions taken: No code changes needed. The branch was already up to date, all checks were green, and there were no unresolved review comments to address.

Hand-off: CI must be re-triggered by a maintainer (close/reopen PR, workflow_dispatch, or a push) before merge.

CopilotAI requested a review from gh-aw-botJuly 2, 2026 11:09
@pelikhan
pelikhan merged commit b58bf2c into mainJul 2, 2026
15 checks passed
@pelikhan
pelikhan deleted the simplify/remove-duplicate-getdiscussionid-71a4ced1158b8298 branch July 2, 2026 12:01
@github-actions

Copy link
Copy Markdown
ContributorAuthor

🎉 This pull request is included in a new release.

Release: v0.82.2

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@gh-aw-bot@pelikhan