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

feat: allow conditional skip on success and fail comments #874

Merged
merged 79 commits into from
Sep 2, 2024

Conversation

babblebey
Copy link
Member

@babblebey babblebey commented Jul 10, 2024

This PR Intend to transfer the flow from semantic-release/gitlab#730 to the github plugin. It introduces the new properties into the configuration option, which are used to perform the stated function.

  • failCommentCondition - used to state the conditions by which the failComment is posted or not
  • successCommentCondition - used to state the conditions by which the successComment is posted or not and where it is posted

Changes Made

  • Added deprecation notice for failTitle, failComment and successComment set as false
  • Introduced logic to fetch more data for issues parsed from pull request body and commit messages to aid successCommentCondition filtering (more datails in feat: allow conditional skip on success and fail comments #874 (comment))
  • Introduced utility to help perform stated functionality
    • buildRelatedIssuesQuery - Builds GraphQL query for fetching PRs/Commits related Issues to a list of commit hash (sha) from parsedIssue number
    • buildAssociatedPRsQuery - Builds GraphQL query for fetching associated PRs to a list of commit hash (sha)
    • buildIssuesOrPRsFromResponseNode - Build associatedPRs or RelatedIssues object (into issue-like object with pull_request property) from the GraphQL repository response

Related Issue

Closes #360
Closes #359
Closes #666
Resolves #529

Screencast/Screenshot

  • Demo "successCommentCondition": false - Do not add Success comment to any Issue or PR
screencast-bpconcjcammlapcogcnnelfmaeghhagj-2024.3.mp4
  • Demo "successCommentCondition": "<% return issue.pull_request; %>" - Add Success comment to only Pull Requests
screencast-bpconcjcammlapcogcnnelfmaeghhagj-2024.4.mp4
  • Demo "successCommentCondition": "<% return !issue.pull_request; %>" - Add Success comment to only Issues
screencast-bpconcjcammlapcogcnnelfmaeghhagj-2024.5.mp4

lib/success.js Outdated Show resolved Hide resolved
lib/fail.js Show resolved Hide resolved
Copy link
Member Author

@babblebey babblebey left a comment

Choose a reason for hiding this comment

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

Hello @fgreinacher,

Kindly help me clarify these observations... see review comments..

…t comment on existing issues when "failCommentCondition" is disallows it`
lib/fail.js Show resolved Hide resolved
Copy link
Contributor

@JonasSchubert JonasSchubert left a comment

Choose a reason for hiding this comment

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

As @fgreinacher said, awesome you picked that up so quickly, @babblebey , thanks a lot! Just found a small typo in one unit test description, beside that it looks good for me.
Will you also add unit tests for success.js?

test/fail.test.js Outdated Show resolved Hide resolved
Co-authored-by: Jonas Schubert <jonas.schubert.projects@web.de>
@babblebey
Copy link
Member Author

Will you also add unit tests for success.js?

Yea, working on that 😉

lib/success.js Outdated Show resolved Hide resolved
lib/fail.js Outdated Show resolved Hide resolved
lib/fail.js Outdated Show resolved Hide resolved
Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
@babblebey babblebey merged commit e097d1c into master Sep 2, 2024
6 checks passed
@babblebey babblebey deleted the feat/conditional-success-fail-comment-skip branch September 2, 2024 16:46
Copy link

github-actions bot commented Sep 2, 2024

🎉 This issue has been resolved in version 10.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants