Skip to content

Allow skipping check with a 'no-issue' label on the PR #650

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

Merged
merged 6 commits into from
Mar 25, 2025

Conversation

gstokkink
Copy link
Contributor

Thought this might be useful upstream as well.

Copy link

No linked issues found. Please add the corresponding issues in the pull request description.
Use GitHub automation to close the issue when a PR is merged

@simoneb simoneb requested a review from Copilot March 25, 2025 10:15
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds functionality to allow the action to be skipped when the PR is labeled with "no-issue". It introduces a new utility function (skipLinkedIssuesCheck), refactors the main action flow accordingly, and adds tests and mocks to verify the behavior.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

File Description
src/action.test.js Added tests for verifying the "no-issue" label functionality and logging
mocks/@actions/github.js Updated mock to include a labels structure based on the PR's "no-issue" flag
src/util.js Added the skipLinkedIssuesCheck function and extended getLinkedIssues to query labels
src/action.js Refactored to use the new skipLinkedIssuesCheck and adjust the flow accordingly
Comments suppressed due to low confidence (1)

src/action.test.js:159

  • [nitpick] Consider returning a boolean value (true) instead of a string to more accurately reflect the expected input type, which could help avoid potential issues if the code later strictly expects a boolean.
core.getBooleanInput.mockReturnValue("true");

@simoneb simoneb requested a review from agubler March 25, 2025 10:17
Copy link
Contributor

@agubler agubler left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you for the contribution @gstokkink

@agubler
Copy link
Contributor

agubler commented Mar 25, 2025

One thing actually @gstokkink, do you mind updating the README to reflect this new feature?

@gstokkink
Copy link
Contributor Author

@agubler something like that?

@agubler
Copy link
Contributor

agubler commented Mar 25, 2025

thanks @gstokkink, one small suggestion to correct the formatting in the table

Co-authored-by: Anthony Gubler <agubler@gmail.com>
@gstokkink
Copy link
Contributor Author

@agubler updated

@gstokkink
Copy link
Contributor Author

@simoneb updated

Copy link
Member

@simoneb simoneb left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the contribution!

@simoneb
Copy link
Member

simoneb commented Mar 25, 2025

@gstokkink one small linting issue to fix and then we're good to merge

@gstokkink
Copy link
Contributor Author

@simoneb d'oh, fixed.

@simoneb simoneb requested a review from Copilot March 25, 2025 16:12
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces functionality to bypass the linked issues check when a pull request is labeled with "no-issue". Key changes include adding conditional label logic in the mocks, updating tests to verify the new behavior, refactoring the action logic to skip checks when applicable, and updating documentation to reflect these changes.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
mocks/@actions/github.js Added conditional labels to simulate a PR with a "no-issue" label.
src/action.test.js Adjusted tests to verify that when the "no-issue" label is present, the check is skipped and comments are deleted; corrected casing in debug messages.
src/util.js Introduced the skipLinkedIssuesCheck() function and updated the GraphQL query to include labels.
src/action.js Reordered logic to perform the skip check before processing linked issues.
README.md Updated documentation to describe the behavior when a "no-issue" label is applied.
Comments suppressed due to low confidence (2)

mocks/@actions/github.js:61

  • [nitpick] Consider extracting the literal "no-issue" into a shared constant to ensure consistency across mocks and production code.
                        { name: "no-issue", },

src/util.js:153

  • [nitpick] Using a shared constant for the "no-issue" label can help prevent discrepancies and ease future updates if the label changes.
  return labels.includes("no-issue");

@simoneb simoneb merged commit 24aa84f into nearform-actions:main Mar 25, 2025
2 of 3 checks passed
@gstokkink gstokkink deleted the with-no-issue-support branch May 22, 2025 11: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.

3 participants