Skip to content

Commit

Permalink
perf: set own verifyConditons default, no need for npm plugin
Browse files Browse the repository at this point in the history
Unlike regular `semantic-release`, this library doesn’t interact with
`npm` remotely and verifying `npm` credentials isn’t productive, only a
relatively expensive operation.
  • Loading branch information
pmowrer committed May 17, 2018
1 parent c9e00e9 commit 0ca8af0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ It helps to think about `semantic-release-github-pr` as a variation on `semantic

A PR gets a comment if:

1. The PR's "from" branch matches the current branch (that this command is being run against).
1. The PR's "from" branch matches the current branch (that this command is being run against).

To cover multiple CI scenarios ([see below](#ci)), either of:
To cover multiple CI scenarios ([see below](#ci)), either of:

1. The PR's [_test_ merge commit](https://developer.github.com/v3/pulls/#response-1) matches the current branch's `git` HEAD.
2. The PR and the current branch have the same `git` HEAD.
1. The PR's [_test_ merge commit](https://developer.github.com/v3/pulls/#response-1) matches the current branch's `git` HEAD.
2. The PR and the current branch have the same `git` HEAD.

2. The PR's base branch matches `master` (default) unless the [`githubPr.branch` configuration option](https://github.com/semantic-release/semantic-release#Release-config) is set.
2. The PR's base branch matches `master` (default) unless the [`githubPr.branch` configuration option](https://github.com/semantic-release/semantic-release#Release-config) is set.

## Configuration

Expand Down Expand Up @@ -115,16 +115,22 @@ Running `semantic-release-github-pr` is equivalent to running `semantic-release`
```json
{
"release": {
"verifyConditions": "@semantic-release/github",
"analyzeCommits": "semantic-release-github-pr",
"generateNotes": "semantic-release-github-pr"
}
}
```

### verifyConditions

The `@semantic-release/github` plugin is set as a default.

#### analyzeCommits

Used as a hook to clean up previous changelog PR comments made by the `generateNotes` plugin, keeping it from flooding a PR with (eventually stale) changelog comments over time.

If `semantic-release` determines that there's no new version, this plugin will also post a "no release" comment on a matching PR.
If `semantic-release` determines that there's no new version, this plugin will also post a "no release" comment on a matching PR.

This plugin doesn't actually analyze commits to determine when to make a release, but defers to the plugin it decorates ([`@semantic-release/commit-analyzer`](https://github.com/semantic-release/commit-analyzer/) by default).

Expand All @@ -136,4 +142,4 @@ Creates a comment on matching PRs with the changelog for the release that would

This plugin doesn't actually generate the changelog that ends up in the PR comment, but defers to the plugin it decorates ([`@semantic-release/release-notes-generator`](https://github.com/semantic-release/release-notes-generator) by default).

See the [`Release config`](#release-config) section for how to configure a custom `generateNotes` plugin and/or set options.
See the [`Release config`](#release-config) section for how to configure a custom `generateNotes` plugin and/or set options.
5 changes: 5 additions & 0 deletions bin/semantic-release-github-pr.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ const { getCurrentBranchName } = require('../src/git-utils');
// Set `dry-run` to keep `semantic-release` from publishing an actual release.
`--dry-run`,
`--branch=${branch}`,
// We hard-set our versions of `analyze-commits` and `generate-notes`.
`--analyze-commits=${plugins}`,
`--generate-notes=${plugins}`,
// We use `extends` here to pick up a soft-set default for `verifyConditions`,
// allowing users to override it (setting a plugin directly from the CLI
// trumps plugins read from a config file).
`--extends=${plugins}`,
]);

execa('semantic-release', args, { stdio: 'inherit' });
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const generateNotes = wrapPlugin(
);

module.exports = {
verifyConditions: '@semantic-release/github',
analyzeCommits: decoratePlugins(analyzeCommits),
generateNotes: decoratePlugins(generateNotes),
};

0 comments on commit 0ca8af0

Please sign in to comment.