semantic-release plugin that imitates the behaviour when the team relies on the squash and merge strategy on GitHub.
$ npm install semantic-release-pr-analyzer -D
The plugin can be configured in the semantic-release configuration file:
{
"plugins": [
[
"semantic-release-pr-analyzer",
{
"strategy": "github"
}
]
]
}
Option | Description | Default |
---|---|---|
strategy |
analyzing strategy | github |
commitAnalyzerConfig |
standard commit-analyzer plugin configuration | default one for commit-analyzer |
notesGeneratorConfig |
standard release-notes-generator plugin configuration | default one for release-notes-generator |
Once PR is merged, GitHib creates a squash commit in the main branch following the rules below:
Number of commits in the pull request | Main Branch Commit Title | Main Branch Commit Description |
---|---|---|
Single commit | The title of the commit message for the single commit, followed by the pull request number | The body text of the commit message for the single commit |
More than one commit | The pull request title, followed by the pull request number | A list of the commit messages for all of the squashed commits, in date order |
You can read more about this in the official GitHub docs. This plugin hijacks semantic-release flow and replaces the commits list with the one that respects these rules into the mix.
The same as the GitHub strategy, but it will throw an error if the first commit title is not equal to the pull request title.
Always analyzes the pull request title and description as a commit.
The same as the Pull Request strategy, but it will throw an error if the first commit body is not equal to the pull request description.
GitHub token to access your repository. Using the secrets.GITHUB_TOKEN
value should be enough.
The pull request number. In the context of GitHub actions, it is achievable as github.event.pull_request.number
Repository path, for example n0th1ng-else/semantic-release-pr-analyzer
. For GitHub actions workflow it is
set automatically.