versionary 1.5.0 → 1.6.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.
@@ -0,0 +1 @@
1
+ export declare function redactCredentials(message: string): string;
@@ -0,0 +1,14 @@
1
+ export function redactCredentials(message) {
2
+ let redacted = message.replace(/([a-z][a-z\d+.-]*:\/\/)[^\s/]*@/giu, "$1[REDACTED]@");
3
+ const tokens = [
4
+ process.env.VERSIONARY_PR_TOKEN,
5
+ process.env.GH_TOKEN,
6
+ process.env.GITHUB_TOKEN,
7
+ ].filter((token) => Boolean(token));
8
+ const secrets = new Set(tokens.flatMap((token) => [token, encodeURIComponent(token)]));
9
+ // Replace longer secrets first so an overlapping token cannot leave a suffix.
10
+ for (const secret of [...secrets].sort((a, b) => b.length - a.length)) {
11
+ redacted = redacted.replaceAll(secret, "[REDACTED]");
12
+ }
13
+ return redacted;
14
+ }
@@ -162,25 +162,25 @@ export function renderReleaseNotesSection(input, options = {}) {
162
162
  sections.push(trimmedHighlights, "");
163
163
  }
164
164
  if (grouped.breaking.length > 0) {
165
- sections.push("### Breaking changes", ...grouped.breaking, "");
165
+ sections.push("### Breaking changes", "", ...grouped.breaking, "");
166
166
  }
167
167
  if (grouped.features.length > 0) {
168
- sections.push("### Features", ...grouped.features, "");
168
+ sections.push("### Features", "", ...grouped.features, "");
169
169
  }
170
170
  if (grouped.fixes.length > 0) {
171
- sections.push("### Bug Fixes", ...grouped.fixes, "");
171
+ sections.push("### Bug Fixes", "", ...grouped.fixes, "");
172
172
  }
173
173
  if (grouped.performance.length > 0) {
174
- sections.push("### Performance Improvements", ...grouped.performance, "");
174
+ sections.push("### Performance Improvements", "", ...grouped.performance, "");
175
175
  }
176
176
  if (grouped.reverts.length > 0) {
177
- sections.push("### Reverts", ...grouped.reverts, "");
177
+ sections.push("### Reverts", "", ...grouped.reverts, "");
178
178
  }
179
179
  if (input.dependencies && input.dependencies.length > 0) {
180
- sections.push("### Dependencies", ...input.dependencies.map((dependency) => `- updated ${dependency.name} to v${dependency.version}`), "");
180
+ sections.push("### Dependencies", "", ...input.dependencies.map((dependency) => `- updated ${dependency.name} to v${dependency.version}`), "");
181
181
  }
182
182
  if (needsOtherChangesFallback(grouped, trimmedHighlights.length > 0, input.dependencies?.length ?? 0)) {
183
- sections.push("### Other changes", ...grouped.other, "");
183
+ sections.push("### Other changes", "", ...grouped.other, "");
184
184
  }
185
185
  const body = [header, "", ...sections].join("\n").trimEnd();
186
186
  if (options.includeFooter) {
@@ -4,6 +4,7 @@ import os from "node:os";
4
4
  import path from "node:path";
5
5
  import { loadConfig } from "../config/load-config.js";
6
6
  import { ensureGitIdentity } from "../git/identity.js";
7
+ import { redactCredentials } from "../git/redact.js";
7
8
  import { getScmClient } from "../scm/client.js";
8
9
  import { resolvePackageStrategyContext, resolveReleaseName, } from "../strategy/package-context.js";
9
10
  import { applyConfiguredArtifactRules } from "./artifact-rules.js";
@@ -985,10 +986,18 @@ export async function closeStaleReviewRequestIfExists(cwd = process.cwd(), optio
985
986
  return result;
986
987
  }
987
988
  export function pushReleaseBranch(cwd, branch) {
988
- execFileSync("git", ["push", "--force-with-lease", "origin", branch], {
989
- cwd,
990
- stdio: ["ignore", "pipe", "ignore"],
991
- });
989
+ try {
990
+ execFileSync("git", ["push", "--force-with-lease", "origin", branch], {
991
+ cwd,
992
+ stdio: ["ignore", "pipe", "pipe"],
993
+ });
994
+ }
995
+ catch (error) {
996
+ const message = error instanceof Error ? error.message : String(error);
997
+ // Captured stderr is included in the message. Do not retain the original
998
+ // error as a cause: its output buffers may contain credentials.
999
+ throw new Error(redactCredentials(message));
1000
+ }
992
1001
  }
993
1002
  export function isReleaseCommitMessage(commitMessage) {
994
1003
  if (/^Versionary-Release:\s*true$/imu.test(commitMessage)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "versionary",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Automatic release framework based on conventional commits and semantic versioning",
5
5
  "keywords": [
6
6
  "releasing",