@auto-canary/omit-release-notes
Version:
Omit release notes plugin for auto
33 lines • 1.56 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/** Ensure a value is an array */
const arrayify = (arr) => (Array.isArray(arr) ? arr : [arr]);
/** Filter PRs with release notes that shouldn't make it into a release. */
class ReleaseNotesPlugin {
/** Initialize the plugin with it's options */
constructor(options) {
/** The name of the plugin */
this.name = 'Omit Release Notes';
this.options = {
username: options.username ? arrayify(options.username) : [],
email: options.email ? arrayify(options.email) : [],
name: options.name ? arrayify(options.name) : [],
labels: options.labels ? arrayify(options.labels) : []
};
}
/** Tap into auto plugin points. */
apply(auto) {
auto.hooks.onCreateChangelog.tap(this.name, changelog => {
changelog.hooks.omitReleaseNotes.tap(this.name, commit => {
if (commit.authors.find(author => Boolean(author.name && this.options.name.includes(author.name))) ||
commit.authors.find(author => Boolean(author.email && this.options.email.includes(author.email))) ||
commit.authors.find(author => Boolean(author.username && this.options.username.includes(author.username))) ||
commit.labels.find(label => Boolean(this.options.labels.includes(label)))) {
return true;
}
});
});
}
}
exports.default = ReleaseNotesPlugin;
//# sourceMappingURL=index.js.map