@semantic-release/github 10.0.3 → 10.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -71,18 +71,20 @@ When using the _GITHUB_TOKEN_, the **minimum required permissions** are:
71
71
 
72
72
  ### Environment variables
73
73
 
74
- | Variable | Description |
75
- | -------------------------------------------- | --------------------------------------------------------- |
76
- | `GH_TOKEN` or `GITHUB_TOKEN` | **Required.** The token used to authenticate with GitHub. |
77
- | `GITHUB_API_URL` or `GH_URL` or `GITHUB_URL` | The GitHub Enterprise endpoint. |
78
- | `GH_PREFIX` or `GITHUB_PREFIX` | The GitHub Enterprise API prefix. |
74
+ | Variable | Description |
75
+ | ------------------------------ | ------------------------------------------------------------------- |
76
+ | `GITHUB_TOKEN` or `GH_TOKEN` | **Required.** The token used to authenticate with GitHub. |
77
+ | `GITHUB_URL` or `GH_URL` | The GitHub server endpoint. |
78
+ | `GITHUB_PREFIX` or `GH_PREFIX` | The GitHub API prefix, relative to `GITHUB_URL`. |
79
+ | `GITHUB_API_URL` | The GitHub API endpoint. Note that this overwrites `GITHUB_PREFIX`. |
79
80
 
80
81
  ### Options
81
82
 
82
83
  | Option | Description | Default |
83
84
  | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
84
- | `githubUrl` | The GitHub Enterprise endpoint. | `GH_URL` or `GITHUB_URL` environment variable. |
85
- | `githubApiPathPrefix` | The GitHub Enterprise API prefix. | `GH_PREFIX` or `GITHUB_PREFIX` environment variable. |
85
+ | `githubUrl` | The GitHub server endpoint. | `GH_URL` or `GITHUB_URL` environment variable. |
86
+ | `githubApiPathPrefix` | The GitHub API prefix, relative to `githubUrl`. | `GH_PREFIX` or `GITHUB_PREFIX` environment variable. |
87
+ | `githubApiUrl` | The GitHub API endpoint. Note that this overwrites `githubApiPathPrefix`. | `GITHUB_API_URL` environment variable. |
86
88
  | `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. |
87
89
  | `assets` | An array of files to upload to the release. See [assets](#assets). | - |
88
90
  | `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>)` |
@@ -15,16 +15,15 @@ export default async function addChannel(pluginConfig, context, { Octokit }) {
15
15
  nextRelease: { name, gitTag, notes },
16
16
  logger,
17
17
  } = context;
18
- const { githubToken, githubUrl, githubApiPathPrefix, proxy } = resolveConfig(
19
- pluginConfig,
20
- context,
21
- );
18
+ const { githubToken, githubUrl, githubApiPathPrefix, githubApiUrl, proxy } =
19
+ resolveConfig(pluginConfig, context);
22
20
  const { owner, repo } = parseGithubUrl(repositoryUrl);
23
21
  const octokit = new Octokit(
24
22
  toOctokitOptions({
25
23
  githubToken,
26
24
  githubUrl,
27
25
  githubApiPathPrefix,
26
+ githubApiUrl,
28
27
  proxy,
29
28
  }),
30
29
  );
package/lib/fail.js CHANGED
@@ -21,6 +21,7 @@ export default async function fail(pluginConfig, context, { Octokit }) {
21
21
  githubToken,
22
22
  githubUrl,
23
23
  githubApiPathPrefix,
24
+ githubApiUrl,
24
25
  proxy,
25
26
  failComment,
26
27
  failTitle,
@@ -32,7 +33,13 @@ export default async function fail(pluginConfig, context, { Octokit }) {
32
33
  logger.log("Skip issue creation.");
33
34
  } else {
34
35
  const octokit = new Octokit(
35
- toOctokitOptions({ githubToken, githubUrl, githubApiPathPrefix, proxy }),
36
+ toOctokitOptions({
37
+ githubToken,
38
+ githubUrl,
39
+ githubApiPathPrefix,
40
+ githubApiUrl,
41
+ proxy,
42
+ }),
36
43
  );
37
44
  // In case the repo changed name, get the new `repo`/`owner` as the search API will not follow redirects
38
45
  const { data: repoData } = await octokit.request(
package/lib/octokit.js CHANGED
@@ -49,14 +49,16 @@ export const SemanticReleaseOctokit = Octokit.plugin(
49
49
  /* c8 ignore stop */
50
50
 
51
51
  /**
52
- * @param {{githubToken: string, proxy: any} | {githubUrl: string, githubApiPathPrefix: string, githubToken: string, proxy: any}} options
52
+ * @param {{githubToken: string, proxy: any} | {githubUrl: string, githubApiPathPrefix: string, githubApiUrl: string,githubToken: string, proxy: any}} options
53
53
  * @returns {{ auth: string, baseUrl?: string, request: { agent?: any } }}
54
54
  */
55
55
  export function toOctokitOptions(options) {
56
56
  const baseUrl =
57
- "githubUrl" in options && options.githubUrl
58
- ? urljoin(options.githubUrl, options.githubApiPathPrefix)
59
- : undefined;
57
+ "githubApiUrl" in options && options.githubApiUrl
58
+ ? options.githubApiUrl
59
+ : "githubUrl" in options && options.githubUrl
60
+ ? urljoin(options.githubUrl, options.githubApiPathPrefix)
61
+ : undefined;
60
62
 
61
63
  const agent = options.proxy
62
64
  ? baseUrl && new URL(baseUrl).protocol.replace(":", "") === "http"
package/lib/publish.js CHANGED
@@ -26,6 +26,7 @@ export default async function publish(pluginConfig, context, { Octokit }) {
26
26
  githubToken,
27
27
  githubUrl,
28
28
  githubApiPathPrefix,
29
+ githubApiUrl,
29
30
  proxy,
30
31
  assets,
31
32
  draftRelease,
@@ -39,6 +40,7 @@ export default async function publish(pluginConfig, context, { Octokit }) {
39
40
  githubToken,
40
41
  githubUrl,
41
42
  githubApiPathPrefix,
43
+ githubApiUrl,
42
44
  proxy,
43
45
  }),
44
46
  );
@@ -3,6 +3,7 @@ import { isNil, castArray } from "lodash-es";
3
3
  export default function resolveConfig(
4
4
  {
5
5
  githubUrl,
6
+ githubApiUrl,
6
7
  githubApiPathPrefix,
7
8
  proxy,
8
9
  assets,
@@ -22,9 +23,10 @@ export default function resolveConfig(
22
23
  ) {
23
24
  return {
24
25
  githubToken: env.GH_TOKEN || env.GITHUB_TOKEN,
25
- githubUrl: githubUrl || env.GITHUB_API_URL || env.GH_URL || env.GITHUB_URL,
26
+ githubUrl: githubUrl || env.GH_URL || env.GITHUB_URL,
26
27
  githubApiPathPrefix:
27
28
  githubApiPathPrefix || env.GH_PREFIX || env.GITHUB_PREFIX || "",
29
+ githubApiUrl: githubApiUrl || env.GITHUB_API_URL,
28
30
  proxy: isNil(proxy) ? env.http_proxy || env.HTTP_PROXY || false : proxy,
29
31
  assets: assets ? castArray(assets) : assets,
30
32
  successComment,
package/lib/success.js CHANGED
@@ -27,6 +27,7 @@ export default async function success(pluginConfig, context, { Octokit }) {
27
27
  githubToken,
28
28
  githubUrl,
29
29
  githubApiPathPrefix,
30
+ githubApiUrl,
30
31
  proxy,
31
32
  successComment,
32
33
  failComment,
@@ -36,7 +37,13 @@ export default async function success(pluginConfig, context, { Octokit }) {
36
37
  } = resolveConfig(pluginConfig, context);
37
38
 
38
39
  const octokit = new Octokit(
39
- toOctokitOptions({ githubToken, githubUrl, githubApiPathPrefix, proxy }),
40
+ toOctokitOptions({
41
+ githubToken,
42
+ githubUrl,
43
+ githubApiPathPrefix,
44
+ githubApiUrl,
45
+ proxy,
46
+ }),
40
47
  );
41
48
 
42
49
  // In case the repo changed name, get the new `repo`/`owner` as the search API will not follow redirects
package/lib/verify.js CHANGED
@@ -56,8 +56,14 @@ export default async function verify(pluginConfig, context, { Octokit }) {
56
56
  options: { repositoryUrl },
57
57
  logger,
58
58
  } = context;
59
- const { githubToken, githubUrl, githubApiPathPrefix, proxy, ...options } =
60
- resolveConfig(pluginConfig, context);
59
+ const {
60
+ githubToken,
61
+ githubUrl,
62
+ githubApiPathPrefix,
63
+ githubApiUrl,
64
+ proxy,
65
+ ...options
66
+ } = resolveConfig(pluginConfig, context);
61
67
 
62
68
  const errors = Object.entries({ ...options, proxy }).reduce(
63
69
  (errors, [option, value]) =>
@@ -70,7 +76,9 @@ export default async function verify(pluginConfig, context, { Octokit }) {
70
76
  [],
71
77
  );
72
78
 
73
- if (githubUrl) {
79
+ if (githubApiUrl) {
80
+ logger.log("Verify GitHub authentication (%s)", githubApiUrl);
81
+ } else if (githubUrl) {
74
82
  logger.log(
75
83
  "Verify GitHub authentication (%s)",
76
84
  urlJoin(githubUrl, githubApiPathPrefix),
@@ -87,7 +95,13 @@ export default async function verify(pluginConfig, context, { Octokit }) {
87
95
  !errors.find(({ code }) => code === "EINVALIDPROXY")
88
96
  ) {
89
97
  const octokit = new Octokit(
90
- toOctokitOptions({ githubToken, githubUrl, githubApiPathPrefix, proxy }),
98
+ toOctokitOptions({
99
+ githubToken,
100
+ githubUrl,
101
+ githubApiPathPrefix,
102
+ githubApiUrl,
103
+ proxy,
104
+ }),
91
105
  );
92
106
 
93
107
  // https://github.com/semantic-release/github/issues/182
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semantic-release/github",
3
3
  "description": "semantic-release plugin to publish a GitHub release and comment on released Pull Requests/Issues",
4
- "version": "10.0.3",
4
+ "version": "10.0.4",
5
5
  "type": "module",
6
6
  "author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)",
7
7
  "ava": {
@@ -40,7 +40,7 @@
40
40
  "url-join": "^5.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "ava": "6.1.2",
43
+ "ava": "6.1.3",
44
44
  "c8": "9.1.0",
45
45
  "cpy": "11.0.1",
46
46
  "cz-conventional-changelog": "3.3.0",
@@ -50,8 +50,8 @@
50
50
  "npm-run-all2": "6.1.2",
51
51
  "prettier": "3.2.5",
52
52
  "publint": "0.2.7",
53
- "semantic-release": "23.0.7",
54
- "sinon": "17.0.1",
53
+ "semantic-release": "23.1.1",
54
+ "sinon": "18.0.0",
55
55
  "tempy": "3.1.0"
56
56
  },
57
57
  "engines": {
@@ -127,5 +127,5 @@
127
127
  "github>semantic-release/.github:renovate-config"
128
128
  ]
129
129
  },
130
- "packageManager": "npm@10.5.1"
130
+ "packageManager": "npm@10.7.0"
131
131
  }