versionary 0.26.0 → 0.27.0

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
@@ -172,6 +172,9 @@ For a quick trial, use:
172
172
  - `off` (default): do not post comments
173
173
  - `best-effort`: post comments and continue on API/permission failures
174
174
  - `strict`: fail release if comment posting fails
175
+ - comments are authored by the account that owns the configured token; see
176
+ [Comment and commit author identity](#comment-and-commit-author-identity)
177
+ to post them under a bot identity
175
178
  - optional monorepo planning with `monorepo-mode` and `packages`:
176
179
  - `independent` computes package bumps per path
177
180
  - `fixed` computes one shared bump across configured package paths
@@ -416,6 +419,33 @@ the composite action. This means release-branch force-pushes are attributed to
416
419
  that token and can trigger downstream workflows when using a PAT/App token.
417
420
  (`github-token` remains as a deprecated alias for backward compatibility.)
418
421
 
422
+ #### Comment and commit author identity
423
+
424
+ Two distinct identities are at play; keep them apart.
425
+
426
+ **Release-reference comments, the GitHub Release, and the tag/branch push** are
427
+ attributed to the account that owns the token you provide. There is no GitHub
428
+ API to set a custom author independent of the token, so this identity always
429
+ follows the token's account:
430
+
431
+ - the workflow's default `GITHUB_TOKEN` acts as `github-actions[bot]` — the
432
+ common case, and what most `semantic-release` setups show
433
+ - a **personal access token (PAT)** acts as your own user
434
+ - a **dedicated bot user account** acts as that account (for example
435
+ `semantic-release`'s own `@semantic-release-bot`): create a separate GitHub
436
+ user, generate a PAT for it, and store it as the release token
437
+ - a **GitHub App installation token** (e.g. minted with
438
+ `actions/create-github-app-token`) acts as `<app-name>[bot]`
439
+
440
+ **The release commit's committer** comes from git's `user.name`/`user.email`,
441
+ not the token. When neither is configured (e.g. a bare CI runner), Versionary
442
+ defaults it to `github-actions[bot]`, so no `git config` step is needed in your
443
+ workflow; an existing identity (local, global, or the one the GitHub Action
444
+ wrapper sets) is left untouched.
445
+
446
+ The release-reference comment body itself is signed by Versionary regardless of
447
+ which account posts it.
448
+
419
449
  Action outputs:
420
450
 
421
451
  - `action`: `noop`, `pr-prepared`, `release-published`, `release-skipped`
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Default committer identity Versionary uses when a repository has no
3
+ * `user.name`/`user.email` configured (for example a bare CI runner).
4
+ *
5
+ * This intentionally mirrors the GitHub Action entrypoint
6
+ * (`src/action/index.ts`), which is a standalone bundle and cannot import this
7
+ * module, so release commits are attributed to the same bot regardless of how
8
+ * Versionary is invoked (composite action vs. running the CLI from source).
9
+ */
10
+ export declare const DEFAULT_GIT_AUTHOR_NAME = "github-actions[bot]";
11
+ export declare const DEFAULT_GIT_AUTHOR_EMAIL = "41898282+github-actions[bot]@users.noreply.github.com";
12
+ /**
13
+ * Ensure git has a committer identity before Versionary creates release
14
+ * commits. This only fills the gap: if `user.name`/`user.email` already resolve
15
+ * (local, global, or system config), they are left untouched. Otherwise a
16
+ * repository-local default is set so `git commit` does not fail with
17
+ * "Please tell me who you are".
18
+ */
19
+ export declare function ensureGitIdentity(cwd: string): void;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_GIT_AUTHOR_EMAIL = exports.DEFAULT_GIT_AUTHOR_NAME = void 0;
4
+ exports.ensureGitIdentity = ensureGitIdentity;
5
+ const node_child_process_1 = require("node:child_process");
6
+ /**
7
+ * Default committer identity Versionary uses when a repository has no
8
+ * `user.name`/`user.email` configured (for example a bare CI runner).
9
+ *
10
+ * This intentionally mirrors the GitHub Action entrypoint
11
+ * (`src/action/index.ts`), which is a standalone bundle and cannot import this
12
+ * module, so release commits are attributed to the same bot regardless of how
13
+ * Versionary is invoked (composite action vs. running the CLI from source).
14
+ */
15
+ exports.DEFAULT_GIT_AUTHOR_NAME = "github-actions[bot]";
16
+ exports.DEFAULT_GIT_AUTHOR_EMAIL = "41898282+github-actions[bot]@users.noreply.github.com";
17
+ function hasGitConfig(cwd, key) {
18
+ try {
19
+ (0, node_child_process_1.execFileSync)("git", ["config", key], {
20
+ cwd,
21
+ stdio: ["ignore", "pipe", "ignore"],
22
+ });
23
+ return true;
24
+ }
25
+ catch {
26
+ return false;
27
+ }
28
+ }
29
+ /**
30
+ * Ensure git has a committer identity before Versionary creates release
31
+ * commits. This only fills the gap: if `user.name`/`user.email` already resolve
32
+ * (local, global, or system config), they are left untouched. Otherwise a
33
+ * repository-local default is set so `git commit` does not fail with
34
+ * "Please tell me who you are".
35
+ */
36
+ function ensureGitIdentity(cwd) {
37
+ if (!hasGitConfig(cwd, "user.name")) {
38
+ (0, node_child_process_1.execFileSync)("git", ["config", "user.name", exports.DEFAULT_GIT_AUTHOR_NAME], {
39
+ cwd,
40
+ stdio: ["ignore", "pipe", "ignore"],
41
+ });
42
+ }
43
+ if (!hasGitConfig(cwd, "user.email")) {
44
+ (0, node_child_process_1.execFileSync)("git", ["config", "user.email", exports.DEFAULT_GIT_AUTHOR_EMAIL], {
45
+ cwd,
46
+ stdio: ["ignore", "pipe", "ignore"],
47
+ });
48
+ }
49
+ }
@@ -321,6 +321,9 @@ function resolvePackageDependencies(plan, packagePath) {
321
321
  return sources
322
322
  .map((sourcePath) => plan.packages?.find((pkg) => pkg.path === sourcePath && pkg.nextVersion))
323
323
  .filter((sourcePackage) => Boolean(sourcePackage))
324
- .map((pkg) => ({ name: pkg.path, version: pkg.nextVersion }))
324
+ .map((pkg) => ({
325
+ name: pkg.path === "." ? plan.packageName : pkg.path,
326
+ version: pkg.nextVersion,
327
+ }))
325
328
  .sort((a, b) => a.name.localeCompare(b.name));
326
329
  }
@@ -19,6 +19,7 @@ const node_child_process_1 = require("node:child_process");
19
19
  const node_fs_1 = __importDefault(require("node:fs"));
20
20
  const node_path_1 = __importDefault(require("node:path"));
21
21
  const load_config_js_1 = require("../config/load-config.js");
22
+ const identity_js_1 = require("../git/identity.js");
22
23
  const client_js_1 = require("../scm/client.js");
23
24
  const package_context_js_1 = require("../strategy/package-context.js");
24
25
  const artifact_rules_js_1 = require("./artifact-rules.js");
@@ -349,6 +350,7 @@ function prepareReleasePr(cwd = process.cwd(), options = {}) {
349
350
  cwd,
350
351
  stdio: ["ignore", "pipe", "ignore"],
351
352
  });
353
+ (0, identity_js_1.ensureGitIdentity)(cwd);
352
354
  (0, node_child_process_1.execFileSync)("git", ["commit", "-m", title, "-m", VERSIONARY_RELEASE_TRAILER], {
353
355
  cwd,
354
356
  stdio: ["ignore", "pipe", "ignore"],
@@ -279,9 +279,7 @@ function createGitHubPlugin() {
279
279
  const commented = [];
280
280
  const mode = input.mode ?? "best-effort";
281
281
  for (const reference of uniqueReferences) {
282
- const body = reference >= 1_000_000_000
283
- ? `This pull request is included in [version ${input.version}](${input.releaseUrl}).`
284
- : `This issue has been resolved in [version ${input.version}](${input.releaseUrl}).`;
282
+ const body = `This is included in [version ${input.version}](${input.releaseUrl}). :tada:\n\nReleased by [Versionary](https://github.com/jolars/versionary).`;
285
283
  try {
286
284
  await octokit.issues.createComment({
287
285
  owner: repo.owner,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "versionary",
3
- "version": "0.26.0",
3
+ "version": "0.27.0",
4
4
  "description": "Automatic release framework based on conventional commits and semantic versioning",
5
5
  "keywords": [
6
6
  "releasing",