Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feat: add successSearchQuery option #558

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion 3 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ When using the _GITHUB_TOKEN_, the **minimum required permissions** are:
| `proxy` | The proxy to use to access the GitHub API. Set to `false` to disable usage of proxy. See [proxy](#proxy). | `HTTP_PROXY` environment variable. |
| `assets` | An array of files to upload to the release. See [assets](#assets). | - |
| `successComment` | The comment to add to each issue and pull request resolved by the release. Set to `false` to disable commenting on issues and pull requests. See [successComment](#successcomment). | `:tada: This issue has been resolved in version ${nextRelease.version} :tada:\n\nThe release is available on [GitHub release](<github_release_url>)` |
| `successSearchQuery` | The GitHub search query used to search for pr's to consider commenting/labeling after release | `repo:${owner}/${repo}+type:pr+is:merged` |
| `failComment` | The content of the issue created when a release fails. Set to `false` to disable opening an issue when a release fails. See [failComment](#failcomment). | Friendly message with links to **semantic-release** documentation and support, with the list of errors that caused the release to fail. |
| `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']` |
Expand Down Expand Up @@ -218,4 +219,4 @@ Valid values for this option are `false`, `"top"` or `"bottom"`.

##### addReleases example

See [The introducing PR](https://github.com/semantic-release/github/pull/282) for an example on how it will look.
See [The introducing PR](https://github.com/semantic-release/github/pull/282) for an example on how it will look.
1 change: 1 addition & 0 deletions 1 index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ async function verifyConditions(pluginConfig, context) {

pluginConfig.assets = defaultTo(pluginConfig.assets, publishPlugin.assets);
pluginConfig.successComment = defaultTo(pluginConfig.successComment, publishPlugin.successComment);
pluginConfig.successSearchQuery = defaultTo(pluginConfig.successSearchQuery, publishPlugin.successSearchQuery);
pluginConfig.failComment = defaultTo(pluginConfig.failComment, publishPlugin.failComment);
pluginConfig.failTitle = defaultTo(pluginConfig.failTitle, publishPlugin.failTitle);
pluginConfig.labels = defaultTo(pluginConfig.labels, publishPlugin.labels);
Expand Down
2 changes: 2 additions & 0 deletions 2 lib/resolve-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = (
proxy,
assets,
successComment,
successSearchQuery,
failTitle,
failComment,
labels,
Expand All @@ -22,6 +23,7 @@ module.exports = (
proxy: isNil(proxy) ? env.http_proxy || env.HTTP_PROXY || false : proxy,
assets: assets ? castArray(assets) : assets,
successComment,
successSearchQuery: isNil(successSearchQuery) ? `repo:${owner}/${repo}+type:pr+is:merged` : successSearchQuery,
failTitle: isNil(failTitle) ? 'The automated release is failing 🚨' : failTitle,
failComment,
labels: isNil(labels) ? ['semantic-release'] : labels === false ? false : castArray(labels),
Expand Down
4 changes: 3 additions & 1 deletion 4 lib/success.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = async (pluginConfig, context) => {
githubApiPathPrefix,
proxy,
successComment,
successSearchQuery,
failComment,
failTitle,
releasedLabels,
Expand All @@ -44,8 +45,9 @@ module.exports = async (pluginConfig, context) => {
const parser = issueParser('github', githubUrl ? {hosts: [githubUrl]} : {});
const releaseInfos = releases.filter((release) => Boolean(release.name));
const shas = commits.map(({hash}) => hash);
let query = successSearchQuery.replace("${owner}", owner).replace("${repo}", repo)

const searchQueries = getSearchQueries(`repo:${owner}/${repo}+type:pr+is:merged`, shas).map(
const searchQueries = getSearchQueries(query, shas).map(
async (q) => (await github.search.issuesAndPullRequests({q})).data.items
);

Expand Down
1 change: 1 addition & 0 deletions 1 lib/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const VALIDATORS = {
(asset) => isStringOrStringArray(asset) || (isPlainObject(asset) && isStringOrStringArray(asset.path))
),
successComment: canBeDisabled(isNonEmptyString),
successSearchQuery: isNonEmptyString,
failTitle: canBeDisabled(isNonEmptyString),
failComment: canBeDisabled(isNonEmptyString),
labels: canBeDisabled(isArrayOf(isNonEmptyString)),
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.