Skip to content

Commit

Permalink
fix(success): fix access to the release notes (#284)
Browse files Browse the repository at this point in the history
There was a wrong assumption that release notes would be passed
separately to the plugin. This is not the case and could break
clients using the new addRelease feature.
This commit fixes the access to the release notes of the next release.
  • Loading branch information
Chumper authored Sep 7, 2020
1 parent db2e9c8 commit 24344df
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ If you have actions that trigger on newly created releases, please use a generat
| `failTitle` | The title of the issue created when a release fails. Set to `false` to disable opening an issue when a release fails. | `The automated release is failing 🚨` |
| `labels` | The [labels](https://help.github.com/articles/about-labels) to add to the issue created when a release fails. Set to `false` to not add any label. | `['semantic-release']` |
| `assignees` | The [assignees](https://help.github.com/articles/assigning-issues-and-pull-requests-to-other-github-users) to add to the issue created when a release fails. | - |
| `releasedLabels` | The [labels](https://help.github.com/articles/about-labels) to add to each issue and pull request resolved by the release. Set to `false` to not add any label. See [releasedLabels](#releasedlabels). | `['released<%= nextRelease.channel ? \` on @\${nextRelease.channel}\` : "" %>']` |
| `releasedLabels` | The [labels](https://help.github.com/articles/about-labels) to add to each issue and pull request resolved by the release. Set to `false` to not add any label. See [releasedLabels](#releasedlabels). | `['released<%= nextRelease.channel ? \` on @\${nextRelease.channel}\` : "" %>']- |
| `addReleases` | Will add release links to the GitHub Release. Can be `false`, `"bottom"` or `"top"`. See [addReleases](#addReleases). | `false` |

#### proxy

Expand Down
5 changes: 2 additions & 3 deletions lib/success.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ module.exports = async (pluginConfig, context) => {
nextRelease,
releases,
logger,
notes,
} = context;
const {
githubToken,
Expand Down Expand Up @@ -152,8 +151,8 @@ module.exports = async (pluginConfig, context) => {
if (!isEmpty(additionalReleases) && !isNil(ghRelaseId)) {
const newBody =
addReleases === 'top'
? additionalReleases.concat('\n---\n', notes)
: notes.concat('\n---\n', additionalReleases);
? additionalReleases.concat('\n---\n', nextRelease.notes)
: nextRelease.notes.concat('\n---\n', additionalReleases);
await github.repos.updateRelease({owner, repo, release_id: ghRelaseId, body: newBody});
}
}
Expand Down
2 changes: 0 additions & 2 deletions test/success.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,6 @@ test.serial('Editing the release to include all release links at the bottom', as
commits,
nextRelease,
releases,
notes: nextRelease.notes,
logger: t.context.logger,
});

Expand Down Expand Up @@ -733,7 +732,6 @@ test.serial('Editing the release to include all release links at the top', async
commits,
nextRelease,
releases,
notes: nextRelease.notes,
logger: t.context.logger,
});

Expand Down

0 comments on commit 24344df

Please sign in to comment.