Socket
Socket
Sign inDemoInstall

@semantic-release/github

Package Overview
Dependencies
Maintainers
4
Versions
168
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@semantic-release/github - npm Package Compare versions

Comparing version 9.0.4 to 9.2.1

6

index.js

@@ -20,3 +20,3 @@ /* eslint require-atomic-updates: off */

const { options } = context;
// If the GitHub publish plugin is used and has `assets`, `successComment`, `failComment`, `failTitle`, `labels` or `assignees` configured, validate it now in order to prevent any release if the configuration is wrong
// If the GitHub publish plugin is used and has `assets`, `successComment`, `failComment`, `failTitle`, `labels`, `discussionCategoryName` or `assignees` configured, validate it now in order to prevent any release if the configuration is wrong
if (options.publish) {

@@ -46,2 +46,6 @@ const publishPlugin =

);
pluginConfig.discussionCategoryName = defaultTo(
pluginConfig.discussionCategoryName,
publishPlugin.discussionCategoryName,
);
}

@@ -48,0 +52,0 @@

@@ -198,1 +198,40 @@ import { inspect } from "node:util";

}
export function EINVALIDRELEASEBODYTEMPLATE({ releaseBodyTemplate }) {
return {
message: "Invalid `releaseBodyTemplate` option.",
details: `The [releaseBodyTemplate option](${linkify(
"README.md#releaseBodyTemplate",
)}) must be a non empty \`String\`.
Your configuration for the \`releaseBodyTemplate\` option is \`${stringify(
releaseBodyTemplate,
)}\`.`,
};
}
export function EINVALIDRELEASENAMETEMPLATE({ releaseNameTemplate }) {
return {
message: "Invalid `releaseNameTemplate` option.",
details: `The [releaseNameTemplate option](${linkify(
"README.md#releaseNameTemplate",
)}) must be a non empty \`String\`.
Your configuration for the \`releaseNameTemplate\` option is \`${stringify(
releaseNameTemplate,
)}\`.`,
};
}
export function EINVALIDDISCUSSIONCATEGORYNAME({ discussionCategoryName }) {
return {
message: "Invalid `discussionCategoryName` option.",
details: `The [discussionCategoryName option](${linkify(
"README.md#discussionCategoryName",
)}) if defined, must be a non empty \`String\`.
Your configuration for the \`discussionCategoryName\` option is \`${stringify(
discussionCategoryName,
)}\`.`,
};
}

3

lib/definitions/retry.js
/**
* Default exponential backoff configuration for retries.
* Default retry config for octokit retry plugin
*/

@@ -8,2 +8,3 @@ export const RETRY_CONF = {

doNotRetry: [400, 401, 403, 422],
retries: 3,
};

@@ -22,3 +22,3 @@ import { resolve, basename, extname } from "node:path";

branch,
nextRelease: { name, gitTag, notes },
nextRelease: { gitTag },
logger,

@@ -33,2 +33,5 @@ } = context;

draftRelease,
releaseNameTemplate,
releaseBodyTemplate,
discussionCategoryName,
} = resolveConfig(pluginConfig, context);

@@ -49,4 +52,4 @@ const { owner, repo } = parseGithubUrl(repositoryUrl);

target_commitish: branch.name,
name,
body: notes,
name: template(releaseNameTemplate)(context),
body: template(releaseBodyTemplate)(context),
prerelease: isPrerelease(branch),

@@ -74,8 +77,18 @@ };

// add discussion_category_name if discussionCategoryName is not undefined or false
if (discussionCategoryName) {
release.discussion_category_name = discussionCategoryName;
}
const {
data: { html_url: url, id: releaseId },
data: { html_url: url, id: releaseId, discussion_url },
} = await octokit.request("POST /repos/{owner}/{repo}/releases", release);
logger.log("Published GitHub release: %s", url);
return { url, name: RELEASE_NAME, id: releaseId };
if (discussionCategoryName) {
logger.log("Created GitHub release discussion: %s", discussion_url);
}
return { url, name: RELEASE_NAME, id: releaseId, discussion_url };
}

@@ -151,16 +164,28 @@

const patchRelease = {
owner,
repo,
release_id: releaseId,
draft: false,
};
// add discussion_category_name if discussionCategoryName is not undefined or false
if (discussionCategoryName) {
patchRelease.discussion_category_name = discussionCategoryName;
}
const {
data: { html_url: url },
data: { html_url: url, discussion_url },
} = await octokit.request(
"PATCH /repos/{owner}/{repo}/releases/{release_id}",
{
owner,
repo,
release_id: releaseId,
draft: false,
},
patchRelease,
);
logger.log("Published GitHub release: %s", url);
return { url, name: RELEASE_NAME, id: releaseId };
if (discussionCategoryName) {
logger.log("Created GitHub release discussion: %s", discussion_url);
}
return { url, name: RELEASE_NAME, id: releaseId, discussion_url };
}

@@ -17,2 +17,5 @@ import { isNil, castArray } from "lodash-es";

draftRelease,
releaseNameTemplate,
releaseBodyTemplate,
discussionCategoryName,
},

@@ -48,3 +51,12 @@ { env },

draftRelease: isNil(draftRelease) ? false : draftRelease,
releaseBodyTemplate: !isNil(releaseBodyTemplate)
? releaseBodyTemplate
: "<%= nextRelease.notes %>",
releaseNameTemplate: !isNil(releaseNameTemplate)
? releaseNameTemplate
: "<%= nextRelease.name %>",
discussionCategoryName: isNil(discussionCategoryName)
? false
: discussionCategoryName,
};
}

@@ -48,2 +48,5 @@ import {

draftRelease: isBoolean,
releaseBodyTemplate: isNonEmptyString,
releaseNameTemplate: isNonEmptyString,
discussionCategoryName: canBeDisabled(isNonEmptyString),
};

@@ -50,0 +53,0 @@

{
"name": "@semantic-release/github",
"description": "semantic-release plugin to publish a GitHub release and comment on released Pull Requests/Issues",
"version": "9.0.4",
"version": "9.2.1",
"type": "module",

@@ -24,7 +24,7 @@ "author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)",

"@octokit/core": "^5.0.0",
"@octokit/plugin-paginate-rest": "^8.0.0",
"@octokit/plugin-paginate-rest": "^9.0.0",
"@octokit/plugin-retry": "^6.0.0",
"@octokit/plugin-throttling": "^7.0.0",
"@octokit/plugin-throttling": "^8.0.0",
"@semantic-release/error": "^4.0.0",
"aggregate-error": "^4.0.1",
"aggregate-error": "^5.0.0",
"debug": "^4.3.4",

@@ -43,8 +43,8 @@ "dir-glob": "^3.0.1",

"ava": "5.3.1",
"c8": "8.0.0",
"c8": "8.0.1",
"cpy": "10.1.0",
"fetch-mock": "npm:@gr2m/fetch-mock@9.11.0-pull-request-644.1",
"prettier": "3.0.0",
"semantic-release": "21.0.7",
"sinon": "15.2.0",
"prettier": "3.0.3",
"semantic-release": "22.0.5",
"sinon": "16.0.0",
"tempy": "3.1.0"

@@ -51,0 +51,0 @@ },

@@ -82,16 +82,19 @@ # @semantic-release/github

| Option | Description | Default |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `githubUrl` | The GitHub Enterprise endpoint. | `GH_URL` or `GITHUB_URL` environment variable. |
| `githubApiPathPrefix` | The GitHub Enterprise API prefix. | `GH_PREFIX` or `GITHUB_PREFIX` environment variable. |
| `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>)` |
| `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']` |
| `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}\` : "" %>']- |
| `addReleases` | Will add release links to the GitHub Release. Can be `false`, `"bottom"` or `"top"`. See [addReleases](#addReleases). | `false` |
| `draftRelease` | A boolean indicating if a GitHub Draft Release should be created instead of publishing an actual GitHub Release. | `false` |
| Option | Description | Default |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `githubUrl` | The GitHub Enterprise endpoint. | `GH_URL` or `GITHUB_URL` environment variable. |
| `githubApiPathPrefix` | The GitHub Enterprise API prefix. | `GH_PREFIX` or `GITHUB_PREFIX` environment variable. |
| `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>)` |
| `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']` |
| `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}\` : "" %>']- |
| `addReleases` | Will add release links to the GitHub Release. Can be `false`, `"bottom"` or `"top"`. See [addReleases](#addReleases). | `false` |
| `draftRelease` | A boolean indicating if a GitHub Draft Release should be created instead of publishing an actual GitHub Release. | `false` |
| `releaseNameTemplate` | A [Lodash template](https://lodash.com/docs#template) to customize the github release's name | `<%= nextverison.name %>` |
| `releaseBodyTemplate` | A [Lodash template](https://lodash.com/docs#template) to customize the github release's body | `<%= nextverison.notes %>` |
| `discussionCategoryName` | The category name in which to create a linked discussion to the release. Set to `false` to disable creating discussion for a release. | `false` |

@@ -98,0 +101,0 @@ #### proxy

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc