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

fix: successComment value in @semantic-release/github config #212

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

dkoo
Copy link
Contributor

@dkoo dkoo commented Jun 25, 2024

All Submissions:

Changes proposed in this Pull Request:

Fixes blocking errors in the release script (example):

[11:18:42 PM] [semantic-release] › ✖  Failed step "fail" of plugin "@semantic-release/github"
[11:18:42 PM] [semantic-release] › ✖  EINVALIDSUCCESSCOMMENT Invalid `successComment` option.
The successComment option (https://github.com/semantic-release/github/blob/master/README.md#successcomment) if defined, must be a non empty String.

Your configuration for the successComment option is true.

[11:18:42 PM] [semantic-release] › ✖  EINVALIDSUCCESSCOMMENT Invalid `successComment` option.
The successComment option (https://github.com/semantic-release/github/blob/master/README.md#successcomment) if defined, must be a non empty String.

Your configuration for the successComment option is true.

The automated release failed with AggregateError: 
    SemanticReleaseError: Invalid `successComment` option.
        at module.exports (/home/circleci/project/node_modules/@semantic-release/github/lib/get-error.js:6:10)
        at /home/circleci/project/node_modules/@semantic-release/github/lib/verify.js:43:23
        at Array.reduce (<anonymous>)
        at module.exports (/home/circleci/project/node_modules/@semantic-release/github/lib/verify.js:40:54)
        at verifyConditions (/home/circleci/project/node_modules/@semantic-release/github/index.js:27:9)
        at validator (/home/circleci/project/node_modules/semantic-release/lib/plugins/normalize.js:34:30)
        at /home/circleci/project/node_modules/semantic-release/lib/plugins/pipeline.js:37:40
        at next (/home/circleci/project/node_modules/p-reduce/index.js:17:9)
        at runMicrotasks (<anonymous>)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at /home/circleci/project/node_modules/semantic-release/lib/plugins/pipeline.js:54:11
    at async Object.pluginsConf.<computed> [as verifyConditions] (/home/circleci/project/node_modules/semantic-release/lib/plugins/index.js:80:11)
    at async run (/home/circleci/project/node_modules/semantic-release/index.js:103:3)
    at async module.exports (/home/circleci/project/node_modules/semantic-release/index.js:269:22)
    at async run (/home/circleci/project/node_modules/newspack-scripts/scripts/release.js:129:20)

In the current release, successComment evals to true if the base branch is a release, alpha, or hotfix branch. true isn't a valid value for this option in the @semantic-release/github plugin—if we want the default commenting behavior, we should simply omit the option from the config object.

This patch only assigns successComment a value of false (meaning we don't want @semantic-release to post a comment to the PR) if the base branch isn't a release, alpha, or hotfix branch. If the base branch IS one of these, omitting successComment from the config should result in @semantic-release posting a default success message to the PR.

How to test the changes in this Pull Request:

Can't think of a way to test this without letting it fly..

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@dkoo dkoo added the bug Something isn't working label Jun 25, 2024
@dkoo dkoo self-assigned this Jun 25, 2024
@dkoo dkoo requested a review from a team as a code owner June 25, 2024 16:40
Copy link

@laurelfulford laurelfulford left a comment

Choose a reason for hiding this comment

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

Thanks @dkoo! Looks good, let's give it a shot! :shipit: 🤞

@dkoo dkoo merged commit dba9d23 into trunk Jun 25, 2024
3 checks passed
@dkoo dkoo deleted the fix/release-script branch June 25, 2024 16:48
@matticbot
Copy link

🎉 This PR is included in version 5.5.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@matticbot
Copy link

🎉 This PR is included in version 5.6.0-alpha.8 🎉

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants