@cycjimmy/semantic-release-action 7.1.0 → 7.1.1
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 +2 -0
- package/docs/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/handleError.js +32 -0
- package/src/index.js +2 -1
package/README.md
CHANGED
|
@@ -178,6 +178,8 @@ steps:
|
|
|
178
178
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
179
179
|
```
|
|
180
180
|
|
|
181
|
+
**NOTE**: `dry-run` mode still requires write access to the repository. At startup, semantic-release verifies push permission by running `git push --dry-run` ([`verifyAuth`](https://github.com/semantic-release/semantic-release/blob/master/lib/git.js)), and GitHub enforces write access for dry-run pushes as well — nothing is actually pushed. If the credentials cannot push — for example, the default `GITHUB_TOKEN` when the job does not grant `permissions: contents: write` — the action fails with `EGITNOPERMISSION: Cannot push to the Git repository.` even in `dry-run` mode. To fix it, grant write permission to the job, e.g. `permissions: contents: write` (or use a token with write access).
|
|
182
|
+
|
|
181
183
|
#### ci
|
|
182
184
|
> {Optional Input Parameter} Whether to run semantic release with CI support (default true).
|
|
183
185
|
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [7.1.1](https://github.com/cycjimmy/semantic-release-action/compare/v7.1.0...v7.1.1) (2026-10-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **ci:** improve error handling for push permission failures ([895d556](https://github.com/cycjimmy/semantic-release-action/commit/895d556be9f4f2e382d2713f135c582cfd36d619)), closes [#312](https://github.com/cycjimmy/semantic-release-action/issues/312)
|
|
7
|
+
|
|
1
8
|
# [7.1.0](https://github.com/cycjimmy/semantic-release-action/compare/v7.0.0...v7.1.0) (2026-10-09)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as core from '@actions/core';
|
|
2
|
+
|
|
3
|
+
const EGITNOPERMISSION_HINT =
|
|
4
|
+
`Push permission check failed (EGITNOPERMISSION). If you use the default GITHUB_TOKEN, ` +
|
|
5
|
+
`grant write access to the job, e.g. "permissions: contents: write". ` +
|
|
6
|
+
`This is also required in dry-run mode: semantic-release verifies push permission with "git push --dry-run". ` +
|
|
7
|
+
`See https://github.com/cycjimmy/semantic-release-action#dry_run`;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Check whether an error, or any aggregated sub-error, has the given code.
|
|
11
|
+
* @param {Error|String} error
|
|
12
|
+
* @param {String} code
|
|
13
|
+
* @returns {Boolean}
|
|
14
|
+
*/
|
|
15
|
+
const hasErrorCode = (error, code) =>
|
|
16
|
+
error?.code === code ||
|
|
17
|
+
(Array.isArray(error?.errors) && error.errors.some((subError) => hasErrorCode(subError, code)));
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Report a failed release to GitHub Actions, adding extra hints for known semantic-release error codes.
|
|
21
|
+
* @param {Error|String} error
|
|
22
|
+
* @returns {void}
|
|
23
|
+
*/
|
|
24
|
+
const handleError = (error) => {
|
|
25
|
+
if (hasErrorCode(error, 'EGITNOPERMISSION')) {
|
|
26
|
+
core.warning(EGITNOPERMISSION_HINT);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
core.setFailed(error);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default handleError;
|
package/src/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
handleRepositoryUrlOption,
|
|
11
11
|
handleSkipNpmPluginOption,
|
|
12
12
|
} from './handleOptions.js';
|
|
13
|
+
import handleError from './handleError.js';
|
|
13
14
|
import setUpJob from './setUpJob.task.js';
|
|
14
15
|
import installSpecifyingVersionSemantic from './installSpecifyingVersionSemantic.task.js';
|
|
15
16
|
import assertSemanticReleaseVersion from './assertSemanticReleaseVersion.task.js';
|
|
@@ -57,5 +58,5 @@ const release = async () => {
|
|
|
57
58
|
|
|
58
59
|
export default async () => {
|
|
59
60
|
core.debug('Initialization successful');
|
|
60
|
-
release().catch(
|
|
61
|
+
release().catch(handleError);
|
|
61
62
|
};
|