@storm-software/git-tools 2.111.28 → 2.112.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 CHANGED
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
21
21
 
22
22
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
23
23
 
24
- [![Version](https://img.shields.io/badge/version-2.111.26-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
24
+ [![Version](https://img.shields.io/badge/version-2.112.0-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
25
25
 
26
26
  <!-- prettier-ignore-start -->
27
27
  <!-- markdownlint-disable -->
package/bin/git.cjs CHANGED
@@ -82017,37 +82017,33 @@ async function resolveTokenData(hostname) {
82017
82017
  );
82018
82018
  }
82019
82019
  async function getGithubReleaseByTag(config, tag) {
82020
- return await makeGithubRequest(
82020
+ return (await makeGithubRequest(
82021
82021
  config,
82022
82022
  `/repos/${config.repo}/releases/tags/${tag}`,
82023
82023
  {}
82024
- );
82024
+ )).data;
82025
82025
  }
82026
82026
  async function makeGithubRequest(config, url2, opts = {}) {
82027
- return (await axios_default(url2, {
82027
+ return await axios_default(url2, {
82028
82028
  ...opts,
82029
82029
  baseURL: config.apiBaseUrl,
82030
82030
  headers: {
82031
82031
  ...opts.headers,
82032
82032
  Authorization: config.token ? `Bearer ${config.token}` : void 0
82033
82033
  }
82034
- })).data;
82034
+ });
82035
82035
  }
82036
82036
  async function createGithubRelease(config, body) {
82037
- return await makeGithubRequest(config, `/repos/${config.repo}/releases`, {
82037
+ return (await makeGithubRequest(config, `/repos/${config.repo}/releases`, {
82038
82038
  method: "POST",
82039
82039
  data: body
82040
- });
82040
+ })).data;
82041
82041
  }
82042
82042
  async function updateGithubRelease(config, id, body) {
82043
- return await makeGithubRequest(
82044
- config,
82045
- `/repos/${config.repo}/releases/${id}`,
82046
- {
82047
- method: "PATCH",
82048
- data: body
82049
- }
82050
- );
82043
+ return (await makeGithubRequest(config, `/repos/${config.repo}/releases/${id}`, {
82044
+ method: "PATCH",
82045
+ data: body
82046
+ })).data;
82051
82047
  }
82052
82048
  function githubNewReleaseURL(config, release) {
82053
82049
  let url2 = `https://${config.hostname}/${config.repo}/releases/new?tag=${release.version}&title=${release.version}&body=${encodeURIComponent(release.body)}&target=${release.commit}`;
@@ -82073,6 +82069,38 @@ async function createGithubRemoteReleaseClient(remoteName = "origin") {
82073
82069
  await resolveTokenData(repoData.hostname)
82074
82070
  );
82075
82071
  }
82072
+ async function isUserAnOrganizationMember(userId, config, remoteName = "origin") {
82073
+ try {
82074
+ const repoData = getGitHubRepoData(remoteName, "github");
82075
+ if (!repoData) {
82076
+ throw new Error(
82077
+ `Unable to validate GitHub actor because the GitHub repo slug could not be determined. Please ensure you have a valid GitHub remote configured.`
82078
+ );
82079
+ }
82080
+ const tokenData = await resolveTokenData(repoData.hostname);
82081
+ if (!tokenData.token) {
82082
+ throw new Error(
82083
+ `Unable to validate GitHub actor because no token was provided. Please set the GITHUB_TOKEN or GH_TOKEN environment variable, or ensure you have an active session via the official gh CLI tool (https://cli.github.com).`
82084
+ );
82085
+ }
82086
+ const result2 = await makeGithubRequest(
82087
+ {
82088
+ repo: repoData.slug,
82089
+ hostname: repoData.hostname,
82090
+ apiBaseUrl: repoData.apiBaseUrl,
82091
+ token: _optionalChain([tokenData, 'optionalAccess', _213 => _213.token]) || null
82092
+ },
82093
+ `/orgs/${config.organization}/members/${userId}`,
82094
+ {}
82095
+ );
82096
+ if (result2.status !== 204) {
82097
+ return false;
82098
+ }
82099
+ return true;
82100
+ } catch (e18) {
82101
+ return false;
82102
+ }
82103
+ }
82076
82104
 
82077
82105
  // src/release/changelog.ts
82078
82106
  function createAPI(overrideReleaseConfig) {
@@ -82138,7 +82166,7 @@ function createAPI(overrideReleaseConfig) {
82138
82166
  if (args.deleteVersionPlans === void 0) {
82139
82167
  args.deleteVersionPlans = true;
82140
82168
  }
82141
- const changelogGenerationEnabled = !!_optionalChain([nxReleaseConfig, 'optionalAccess', _213 => _213.changelog, 'optionalAccess', _214 => _214.workspaceChangelog]) || _optionalChain([nxReleaseConfig, 'optionalAccess', _215 => _215.groups]) && Object.values(_optionalChain([nxReleaseConfig, 'optionalAccess', _216 => _216.groups])).some((g) => g.changelog);
82169
+ const changelogGenerationEnabled = !!_optionalChain([nxReleaseConfig, 'optionalAccess', _214 => _214.changelog, 'optionalAccess', _215 => _215.workspaceChangelog]) || _optionalChain([nxReleaseConfig, 'optionalAccess', _216 => _216.groups]) && Object.values(_optionalChain([nxReleaseConfig, 'optionalAccess', _217 => _217.groups])).some((g) => g.changelog);
82142
82170
  if (!changelogGenerationEnabled) {
82143
82171
  _output.output.warn({
82144
82172
  title: `Changelogs are disabled. No changelog entries will be generated`,
@@ -82149,7 +82177,7 @@ function createAPI(overrideReleaseConfig) {
82149
82177
  return {};
82150
82178
  }
82151
82179
  const tree = new (0, _tree.FsTree)(_workspaceroot.workspaceRoot, !!args.verbose);
82152
- const useAutomaticFromRef = _optionalChain([nxReleaseConfig, 'optionalAccess', _217 => _217.changelog, 'optionalAccess', _218 => _218.automaticFromRef]) || args.firstRelease;
82180
+ const useAutomaticFromRef = _optionalChain([nxReleaseConfig, 'optionalAccess', _218 => _218.changelog, 'optionalAccess', _219 => _219.automaticFromRef]) || args.firstRelease;
82153
82181
  const { workspaceChangelogVersion, projectsVersionData } = resolveChangelogVersions(
82154
82182
  args,
82155
82183
  releaseGroups,
@@ -82158,20 +82186,20 @@ function createAPI(overrideReleaseConfig) {
82158
82186
  const to = args.to || "HEAD";
82159
82187
  const toSHA = await _git.getCommitHash.call(void 0, to);
82160
82188
  const headSHA = to === "HEAD" ? toSHA : await _git.getCommitHash.call(void 0, "HEAD");
82161
- const autoCommitEnabled = _nullishCoalesce(args.gitCommit, () => ( _optionalChain([nxReleaseConfig, 'access', _219 => _219.changelog, 'optionalAccess', _220 => _220.git, 'access', _221 => _221.commit])));
82189
+ const autoCommitEnabled = _nullishCoalesce(args.gitCommit, () => ( _optionalChain([nxReleaseConfig, 'access', _220 => _220.changelog, 'optionalAccess', _221 => _221.git, 'access', _222 => _222.commit])));
82162
82190
  if (autoCommitEnabled && headSHA !== toSHA) {
82163
82191
  throw new Error(
82164
82192
  `You are attempting to recreate the changelog for an old release (Head: "${headSHA}", To: "${toSHA}", From: "${args.from}"), but you have enabled auto-commit mode. Please disable auto-commit mode by updating your nx.json, or passing --git-commit=false`
82165
82193
  );
82166
82194
  }
82167
- const commitMessage = args.gitCommitMessage || _optionalChain([nxReleaseConfig, 'access', _222 => _222.changelog, 'optionalAccess', _223 => _223.git, 'optionalAccess', _224 => _224.commitMessage]);
82195
+ const commitMessage = args.gitCommitMessage || _optionalChain([nxReleaseConfig, 'access', _223 => _223.changelog, 'optionalAccess', _224 => _224.git, 'optionalAccess', _225 => _225.commitMessage]);
82168
82196
  const commitMessageValues = _shared.createCommitMessageValues.call(void 0,
82169
82197
  releaseGroups,
82170
82198
  releaseGroupToFilteredProjects,
82171
82199
  projectsVersionData,
82172
82200
  commitMessage
82173
82201
  );
82174
- const gitTagValues = _nullishCoalesce(args.gitTag, () => ( _optionalChain([nxReleaseConfig, 'access', _225 => _225.changelog, 'optionalAccess', _226 => _226.git, 'access', _227 => _227.tag]))) ? _shared.createGitTagValues.call(void 0,
82202
+ const gitTagValues = _nullishCoalesce(args.gitTag, () => ( _optionalChain([nxReleaseConfig, 'access', _226 => _226.changelog, 'optionalAccess', _227 => _227.git, 'access', _228 => _228.tag]))) ? _shared.createGitTagValues.call(void 0,
82175
82203
  releaseGroups,
82176
82204
  releaseGroupToFilteredProjects,
82177
82205
  projectsVersionData
@@ -82232,7 +82260,7 @@ function createAPI(overrideReleaseConfig) {
82232
82260
  nxReleaseConfig.releaseTagPattern,
82233
82261
  {},
82234
82262
  nxReleaseConfig.releaseTagPatternCheckAllBranchesWhen
82235
- )), 'optionalAccess', async _228 => _228.tag]);
82263
+ )), 'optionalAccess', async _229 => _229.tag]);
82236
82264
  if (!workspaceChangelogFromRef) {
82237
82265
  if (useAutomaticFromRef) {
82238
82266
  workspaceChangelogFromRef = await _git.getFirstGitCommit.call(void 0, );
@@ -82286,7 +82314,7 @@ function createAPI(overrideReleaseConfig) {
82286
82314
  )
82287
82315
  });
82288
82316
  if (workspaceChangelog && shouldCreateGitHubRelease(
82289
- _optionalChain([nxReleaseConfig, 'access', _229 => _229.changelog, 'optionalAccess', _230 => _230.workspaceChangelog]),
82317
+ _optionalChain([nxReleaseConfig, 'access', _230 => _230.changelog, 'optionalAccess', _231 => _231.workspaceChangelog]),
82290
82318
  args.createRelease
82291
82319
  )) {
82292
82320
  postGitTasks.push(async (latestCommit) => {
@@ -82300,7 +82328,7 @@ function createAPI(overrideReleaseConfig) {
82300
82328
 
82301
82329
  ${contents}`);
82302
82330
  await createOrUpdateGithubRelease(
82303
- _optionalChain([nxReleaseConfig, 'access', _231 => _231.changelog, 'optionalAccess', _232 => _232.workspaceChangelog]) ? _optionalChain([nxReleaseConfig, 'access', _233 => _233.changelog, 'optionalAccess', _234 => _234.workspaceChangelog, 'access', _235 => _235.createRelease]) : _github.defaultCreateReleaseProvider,
82331
+ _optionalChain([nxReleaseConfig, 'access', _232 => _232.changelog, 'optionalAccess', _233 => _233.workspaceChangelog]) ? _optionalChain([nxReleaseConfig, 'access', _234 => _234.changelog, 'optionalAccess', _235 => _235.workspaceChangelog, 'access', _236 => _236.createRelease]) : _github.defaultCreateReleaseProvider,
82304
82332
  workspaceChangelog.releaseVersion,
82305
82333
  contents,
82306
82334
  latestCommit,
@@ -82318,13 +82346,13 @@ ${contents}`);
82318
82346
  continue;
82319
82347
  }
82320
82348
  for (const project of releaseGroup.projects) {
82321
- if (!_optionalChain([projectsVersionData, 'access', _236 => _236[project], 'optionalAccess', _237 => _237.newVersion])) {
82349
+ if (!_optionalChain([projectsVersionData, 'access', _237 => _237[project], 'optionalAccess', _238 => _238.newVersion])) {
82322
82350
  continue;
82323
82351
  }
82324
82352
  const dependentProjects = (projectsVersionData[project].dependentProjects || []).map((dep) => {
82325
82353
  return {
82326
82354
  dependencyName: dep.source,
82327
- newVersion: _optionalChain([projectsVersionData, 'access', _238 => _238[dep.source], 'optionalAccess', _239 => _239.newVersion])
82355
+ newVersion: _optionalChain([projectsVersionData, 'access', _239 => _239[dep.source], 'optionalAccess', _240 => _240.newVersion])
82328
82356
  };
82329
82357
  }).filter((b) => b.newVersion !== null);
82330
82358
  for (const dependent of dependentProjects) {
@@ -82346,13 +82374,13 @@ ${contents}`);
82346
82374
  if (config === false) {
82347
82375
  continue;
82348
82376
  }
82349
- const projects = _optionalChain([args, 'access', _240 => _240.projects, 'optionalAccess', _241 => _241.length]) ? (
82377
+ const projects = _optionalChain([args, 'access', _241 => _241.projects, 'optionalAccess', _242 => _242.length]) ? (
82350
82378
  // If the user has passed a list of projects, we need to use the filtered list of projects within the release group, plus any dependents
82351
82379
  Array.from(releaseGroupToFilteredProjects.get(releaseGroup)).flatMap(
82352
82380
  (project) => {
82353
82381
  return [
82354
82382
  project,
82355
- ..._optionalChain([projectsVersionData, 'access', _242 => _242[project], 'optionalAccess', _243 => _243.dependentProjects, 'access', _244 => _244.map, 'call', _245 => _245(
82383
+ ..._optionalChain([projectsVersionData, 'access', _243 => _243[project], 'optionalAccess', _244 => _244.dependentProjects, 'access', _245 => _245.map, 'call', _246 => _246(
82356
82384
  (dep) => dep.source
82357
82385
  )]) || []
82358
82386
  ];
@@ -82397,14 +82425,14 @@ ${contents}`);
82397
82425
  releaseGroupName: releaseGroup.name
82398
82426
  },
82399
82427
  releaseGroup.releaseTagPatternCheckAllBranchesWhen
82400
- )), 'optionalAccess', async _246 => _246.tag]);
82428
+ )), 'optionalAccess', async _247 => _247.tag]);
82401
82429
  if (!fromRef && useAutomaticFromRef) {
82402
82430
  const firstCommit = await _git.getFirstGitCommit.call(void 0, );
82403
82431
  const allCommits = await getCommits(firstCommit, toSHA);
82404
82432
  const commitsForProject = allCommits.filter(
82405
82433
  (c) => c.affectedFiles.find((f) => f.startsWith(project.data.root))
82406
82434
  );
82407
- fromRef = _optionalChain([commitsForProject, 'access', _247 => _247[0], 'optionalAccess', _248 => _248.shortHash]);
82435
+ fromRef = _optionalChain([commitsForProject, 'access', _248 => _248[0], 'optionalAccess', _249 => _249.shortHash]);
82408
82436
  if (args.verbose) {
82409
82437
  console.log(
82410
82438
  `Determined --from ref for ${project.name} from the first commit in which it exists: ${fromRef}`
@@ -82532,7 +82560,7 @@ ${contents}`);
82532
82560
  releaseGroup.releaseTagPattern,
82533
82561
  {},
82534
82562
  releaseGroup.releaseTagPatternCheckAllBranchesWhen
82535
- )), 'optionalAccess', async _249 => _249.tag]);
82563
+ )), 'optionalAccess', async _250 => _250.tag]);
82536
82564
  if (!fromRef) {
82537
82565
  if (useAutomaticFromRef) {
82538
82566
  fromRef = await _git.getFirstGitCommit.call(void 0, );
@@ -82721,17 +82749,17 @@ async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTa
82721
82749
  });
82722
82750
  deletedFiles = Array.from(planFiles);
82723
82751
  }
82724
- if (_nullishCoalesce(args.gitCommit, () => ( _optionalChain([nxReleaseConfig, 'access', _250 => _250.changelog, 'optionalAccess', _251 => _251.git, 'access', _252 => _252.commit])))) {
82752
+ if (_nullishCoalesce(args.gitCommit, () => ( _optionalChain([nxReleaseConfig, 'access', _251 => _251.changelog, 'optionalAccess', _252 => _252.git, 'access', _253 => _253.commit])))) {
82725
82753
  await commitChanges({
82726
82754
  changedFiles,
82727
82755
  deletedFiles,
82728
82756
  isDryRun: !!args.dryRun,
82729
82757
  isVerbose: !!args.verbose,
82730
82758
  gitCommitMessages: commitMessageValues,
82731
- gitCommitArgs: _nullishCoalesce(args.gitCommitArgs, () => ( _optionalChain([nxReleaseConfig, 'access', _253 => _253.changelog, 'optionalAccess', _254 => _254.git, 'access', _255 => _255.commitArgs])))
82759
+ gitCommitArgs: _nullishCoalesce(args.gitCommitArgs, () => ( _optionalChain([nxReleaseConfig, 'access', _254 => _254.changelog, 'optionalAccess', _255 => _255.git, 'access', _256 => _256.commitArgs])))
82732
82760
  });
82733
82761
  latestCommit = await _git.getCommitHash.call(void 0, "HEAD");
82734
- } else if ((_nullishCoalesce(args.stageChanges, () => ( _optionalChain([nxReleaseConfig, 'access', _256 => _256.changelog, 'optionalAccess', _257 => _257.git, 'access', _258 => _258.stageChanges])))) && changes.length) {
82762
+ } else if ((_nullishCoalesce(args.stageChanges, () => ( _optionalChain([nxReleaseConfig, 'access', _257 => _257.changelog, 'optionalAccess', _258 => _258.git, 'access', _259 => _259.stageChanges])))) && changes.length) {
82735
82763
  _output.output.logSingleLine(`Staging changed files with git`);
82736
82764
  await _git.gitAdd.call(void 0, {
82737
82765
  changedFiles,
@@ -82740,19 +82768,19 @@ async function applyChangesAndExit(args, nxReleaseConfig, tree, toSHA, postGitTa
82740
82768
  verbose: args.verbose
82741
82769
  });
82742
82770
  }
82743
- if (_nullishCoalesce(args.gitTag, () => ( _optionalChain([nxReleaseConfig, 'access', _259 => _259.changelog, 'optionalAccess', _260 => _260.git, 'access', _261 => _261.tag])))) {
82771
+ if (_nullishCoalesce(args.gitTag, () => ( _optionalChain([nxReleaseConfig, 'access', _260 => _260.changelog, 'optionalAccess', _261 => _261.git, 'access', _262 => _262.tag])))) {
82744
82772
  _output.output.logSingleLine(`Tagging commit with git`);
82745
82773
  for (const tag of gitTagValues) {
82746
82774
  await gitTag({
82747
82775
  tag,
82748
- message: args.gitTagMessage || _optionalChain([nxReleaseConfig, 'access', _262 => _262.changelog, 'optionalAccess', _263 => _263.git, 'access', _264 => _264.tagMessage]),
82749
- additionalArgs: args.gitTagArgs || _optionalChain([nxReleaseConfig, 'access', _265 => _265.changelog, 'optionalAccess', _266 => _266.git, 'access', _267 => _267.tagArgs]),
82776
+ message: args.gitTagMessage || _optionalChain([nxReleaseConfig, 'access', _263 => _263.changelog, 'optionalAccess', _264 => _264.git, 'access', _265 => _265.tagMessage]),
82777
+ additionalArgs: args.gitTagArgs || _optionalChain([nxReleaseConfig, 'access', _266 => _266.changelog, 'optionalAccess', _267 => _267.git, 'access', _268 => _268.tagArgs]),
82750
82778
  dryRun: args.dryRun,
82751
82779
  verbose: args.verbose
82752
82780
  });
82753
82781
  }
82754
82782
  }
82755
- if (_nullishCoalesce(args.gitPush, () => ( _optionalChain([nxReleaseConfig, 'access', _268 => _268.changelog, 'optionalAccess', _269 => _269.git, 'access', _270 => _270.push])))) {
82783
+ if (_nullishCoalesce(args.gitPush, () => ( _optionalChain([nxReleaseConfig, 'access', _269 => _269.changelog, 'optionalAccess', _270 => _270.git, 'access', _271 => _271.push])))) {
82756
82784
  _output.output.logSingleLine(`Pushing to git remote "${args.gitRemote}"`);
82757
82785
  await _git.gitPush.call(void 0, {
82758
82786
  gitRemote: args.gitRemote,
@@ -82778,7 +82806,7 @@ async function generateChangelogForWorkspace({
82778
82806
  `Unable to determine the Storm workspace config. Please ensure that your storm-workspace.json file is present and valid.`
82779
82807
  );
82780
82808
  }
82781
- const config = _optionalChain([nxReleaseConfig, 'access', _271 => _271.changelog, 'optionalAccess', _272 => _272.workspaceChangelog]);
82809
+ const config = _optionalChain([nxReleaseConfig, 'access', _272 => _272.changelog, 'optionalAccess', _273 => _273.workspaceChangelog]);
82782
82810
  if (config === false) {
82783
82811
  return;
82784
82812
  }
@@ -82800,7 +82828,7 @@ async function generateChangelogForWorkspace({
82800
82828
  });
82801
82829
  return;
82802
82830
  }
82803
- if (_optionalChain([Object, 'access', _273 => _273.values, 'call', _274 => _274(_nullishCoalesce(nxReleaseConfig.groups, () => ( {}))), 'access', _275 => _275[0], 'optionalAccess', _276 => _276.projectsRelationship]) === "independent") {
82831
+ if (_optionalChain([Object, 'access', _274 => _274.values, 'call', _275 => _275(_nullishCoalesce(nxReleaseConfig.groups, () => ( {}))), 'access', _276 => _276[0], 'optionalAccess', _277 => _277.projectsRelationship]) === "independent") {
82804
82832
  _output.output.warn({
82805
82833
  title: `Workspace changelog is enabled, but you have configured an independent projects relationship. This is not supported, so workspace changelog will be disabled.`,
82806
82834
  bodyLines: [
@@ -82866,7 +82894,7 @@ async function generateChangelogForWorkspace({
82866
82894
  releaseVersion,
82867
82895
  interpolatedTreePath,
82868
82896
  contents,
82869
- tree.exists(interpolatedTreePath) ? _optionalChain([tree, 'access', _277 => _277.read, 'call', _278 => _278(interpolatedTreePath), 'optionalAccess', _279 => _279.toString, 'call', _280 => _280()]) : "",
82897
+ tree.exists(interpolatedTreePath) ? _optionalChain([tree, 'access', _278 => _278.read, 'call', _279 => _279(interpolatedTreePath), 'optionalAccess', _280 => _280.toString, 'call', _281 => _281()]) : "",
82870
82898
  null,
82871
82899
  workspaceConfig
82872
82900
  )
@@ -82911,7 +82939,7 @@ async function generateChangelogForProjects({
82911
82939
  workspaceRoot: ""
82912
82940
  });
82913
82941
  }
82914
- const newVersion = _optionalChain([projectsVersionData, 'access', _281 => _281[project.name], 'optionalAccess', _282 => _282.newVersion]);
82942
+ const newVersion = _optionalChain([projectsVersionData, 'access', _282 => _282[project.name], 'optionalAccess', _283 => _283.newVersion]);
82915
82943
  if (!newVersion) {
82916
82944
  continue;
82917
82945
  }
@@ -82967,7 +82995,7 @@ ${contents}`.trim()
82967
82995
  releaseVersion,
82968
82996
  interpolatedTreePath,
82969
82997
  contents,
82970
- tree.exists(interpolatedTreePath) ? _optionalChain([tree, 'access', _283 => _283.read, 'call', _284 => _284(interpolatedTreePath), 'optionalAccess', _285 => _285.toString, 'call', _286 => _286()]) : "",
82998
+ tree.exists(interpolatedTreePath) ? _optionalChain([tree, 'access', _284 => _284.read, 'call', _285 => _285(interpolatedTreePath), 'optionalAccess', _286 => _286.toString, 'call', _287 => _287()]) : "",
82971
82999
  project.name,
82972
83000
  workspaceConfig
82973
83001
  )
@@ -82991,11 +83019,11 @@ ${contents}`.trim()
82991
83019
  return projectChangelogs;
82992
83020
  }
82993
83021
  function checkChangelogFilesEnabled(nxReleaseConfig) {
82994
- if (_optionalChain([nxReleaseConfig, 'access', _287 => _287.changelog, 'optionalAccess', _288 => _288.workspaceChangelog]) && _optionalChain([nxReleaseConfig, 'access', _289 => _289.changelog, 'optionalAccess', _290 => _290.workspaceChangelog, 'access', _291 => _291.file])) {
83022
+ if (_optionalChain([nxReleaseConfig, 'access', _288 => _288.changelog, 'optionalAccess', _289 => _289.workspaceChangelog]) && _optionalChain([nxReleaseConfig, 'access', _290 => _290.changelog, 'optionalAccess', _291 => _291.workspaceChangelog, 'access', _292 => _292.file])) {
82995
83023
  return true;
82996
83024
  }
82997
83025
  return Object.values(_nullishCoalesce(nxReleaseConfig.groups, () => ( {}))).some(
82998
- (releaseGroup) => typeof _optionalChain([releaseGroup, 'optionalAccess', _292 => _292.changelog]) === "boolean" && releaseGroup.changelog || _optionalChain([releaseGroup, 'optionalAccess', _293 => _293.changelog, 'optionalAccess', _294 => _294.file])
83026
+ (releaseGroup) => typeof _optionalChain([releaseGroup, 'optionalAccess', _293 => _293.changelog]) === "boolean" && releaseGroup.changelog || _optionalChain([releaseGroup, 'optionalAccess', _294 => _294.changelog, 'optionalAccess', _295 => _295.file])
82999
83027
  );
83000
83028
  }
83001
83029
  async function getCommits(fromSHA, toSHA) {
@@ -83089,7 +83117,7 @@ function formatGithubReleaseNotes(releaseVersion, content, projectName, workspac
83089
83117
  if (!workspaceConfig) {
83090
83118
  return content;
83091
83119
  }
83092
- return `![${_optionalChain([titleCase, 'call', _295 => _295(workspaceConfig.organization), 'optionalAccess', _296 => _296.replaceAll, 'call', _297 => _297(" ", "-")])}](${workspaceConfig.release.banner})
83120
+ return `![${_optionalChain([titleCase, 'call', _296 => _296(workspaceConfig.organization), 'optionalAccess', _297 => _297.replaceAll, 'call', _298 => _298(" ", "-")])}](${workspaceConfig.release.banner})
83093
83121
  ${workspaceConfig.release.header || ""}
83094
83122
 
83095
83123
  # ${projectName ? `${titleCase(projectName)} ` : ""}v${releaseVersion.rawVersion}
@@ -83098,7 +83126,7 @@ We at [${titleCase(workspaceConfig.organization)}](${workspaceConfig.homepage})
83098
83126
 
83099
83127
  These changes are released under the ${workspaceConfig.license.includes("license") ? workspaceConfig.license : `${workspaceConfig.license} license`}. You can find more details on [our licensing page](${workspaceConfig.licensing}). You can find guides, API references, and other documentation around this release (and much more) on [our documentation site](${workspaceConfig.docs}).
83100
83128
 
83101
- If you have any questions or comments, feel free to reach out to the team on [Discord](${workspaceConfig.account.discord}) or [our contact page](${workspaceConfig.contact}). Please help us spread the word by giving [this repository](https://github.com/${workspaceConfig.organization}/${workspaceConfig.name}) a star \u2B50 on GitHub or [posting on X (Twitter)](https://x.com/intent/tweet?text=Check%20out%20the%20latest%20@${workspaceConfig.account.twitter}%20release%20${projectName ? `${_optionalChain([titleCase, 'call', _298 => _298(projectName), 'optionalAccess', _299 => _299.replaceAll, 'call', _300 => _300(" ", "%20")])}%20` : ""}v${releaseVersion.rawVersion}%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/${workspaceConfig.organization}/${workspaceConfig.name}/releases/tag/${releaseVersion.gitTag}) about this release!
83129
+ If you have any questions or comments, feel free to reach out to the team on [Discord](${workspaceConfig.account.discord}) or [our contact page](${workspaceConfig.contact}). Please help us spread the word by giving [this repository](https://github.com/${workspaceConfig.organization}/${workspaceConfig.name}) a star \u2B50 on GitHub or [posting on X (Twitter)](https://x.com/intent/tweet?text=Check%20out%20the%20latest%20@${workspaceConfig.account.twitter}%20release%20${projectName ? `${_optionalChain([titleCase, 'call', _299 => _299(projectName), 'optionalAccess', _300 => _300.replaceAll, 'call', _301 => _301(" ", "%20")])}%20` : ""}v${releaseVersion.rawVersion}%20%F0%9F%9A%80%0D%0A%0D%0Ahttps://github.com/${workspaceConfig.organization}/${workspaceConfig.name}/releases/tag/${releaseVersion.gitTag}) about this release!
83102
83130
 
83103
83131
  ## Release Notes
83104
83132
 
@@ -83179,6 +83207,18 @@ var DEFAULT_RELEASE_CONFIG = {
83179
83207
 
83180
83208
  // src/release/run.ts
83181
83209
  var runRelease = async (config, options) => {
83210
+ if (!process.env.GITHUB_ACTOR) {
83211
+ throw new Error("The `GITHUB_ACTOR` environment variable is not set.");
83212
+ }
83213
+ if (!await isUserAnOrganizationMember(process.env.GITHUB_ACTOR, config)) {
83214
+ _chunkXE275LJTcjs.writeFatal.call(void 0,
83215
+ "You must be a member of the Storm Software organization to run the release process.",
83216
+ config
83217
+ );
83218
+ throw new Error(
83219
+ `The GitHub actor "${process.env.GITHUB_ACTOR}" is not a member of the organization "${config.organization}". Only members of the organization can initiate releases.`
83220
+ );
83221
+ }
83182
83222
  const name = config.bot.name;
83183
83223
  const email = config.bot.email ? config.bot.email : config.bot.name ? `${config.bot.name}@users.noreply.github.com` : "bot@stormsoftware.com";
83184
83224
  process.env.GIT_AUTHOR_NAME = name;
@@ -83200,10 +83240,10 @@ var runRelease = async (config, options) => {
83200
83240
  `,
83201
83241
  config
83202
83242
  );
83203
- if (_optionalChain([nxJson, 'access', _301 => _301.release, 'optionalAccess', _302 => _302.groups])) {
83243
+ if (_optionalChain([nxJson, 'access', _302 => _302.release, 'optionalAccess', _303 => _303.groups])) {
83204
83244
  nxJson.release.groups = Object.keys(nxJson.release.groups).reduce(
83205
83245
  (ret, groupName) => {
83206
- const groupConfig = _optionalChain([nxJson, 'access', _303 => _303.release, 'optionalAccess', _304 => _304.groups, 'optionalAccess', _305 => _305[groupName]]);
83246
+ const groupConfig = _optionalChain([nxJson, 'access', _304 => _304.release, 'optionalAccess', _305 => _305.groups, 'optionalAccess', _306 => _306[groupName]]);
83207
83247
  ret[groupName] = _chunkFMYKTN2Zcjs.defu.call(void 0, groupConfig, DEFAULT_RELEASE_GROUP_CONFIG);
83208
83248
  return ret;
83209
83249
  },
@@ -83233,7 +83273,7 @@ var runRelease = async (config, options) => {
83233
83273
  });
83234
83274
  await releaseChangelog({
83235
83275
  ...options,
83236
- version: _optionalChain([nxReleaseConfig, 'optionalAccess', _306 => _306.projectsRelationship]) !== "fixed" ? void 0 : workspaceVersion,
83276
+ version: _optionalChain([nxReleaseConfig, 'optionalAccess', _307 => _307.projectsRelationship]) !== "fixed" ? void 0 : workspaceVersion,
83237
83277
  versionData: projectsVersionData,
83238
83278
  dryRun: false,
83239
83279
  verbose: _chunkXE275LJTcjs.isVerbose.call(void 0, config.logLevel),
@@ -83250,7 +83290,7 @@ var runRelease = async (config, options) => {
83250
83290
  );
83251
83291
  } else {
83252
83292
  const changedProjects = Object.keys(projectsVersionData).filter(
83253
- (key) => _optionalChain([projectsVersionData, 'access', _307 => _307[key], 'optionalAccess', _308 => _308.newVersion])
83293
+ (key) => _optionalChain([projectsVersionData, 'access', _308 => _308[key], 'optionalAccess', _309 => _309.newVersion])
83254
83294
  );
83255
83295
  if (changedProjects.length > 0) {
83256
83296
  _chunkXE275LJTcjs.writeInfo.call(void 0,
@@ -83266,14 +83306,14 @@ ${changedProjects.map((changedProject) => ` - ${changedProject}`).join("\n")}
83266
83306
  verbose: _chunkXE275LJTcjs.isVerbose.call(void 0, config.logLevel)
83267
83307
  });
83268
83308
  const failedProjects = Object.keys(result2).filter(
83269
- (key) => _optionalChain([result2, 'access', _309 => _309[key], 'optionalAccess', _310 => _310.code]) && _optionalChain([result2, 'access', _311 => _311[key], 'optionalAccess', _312 => _312.code]) > 0
83309
+ (key) => _optionalChain([result2, 'access', _310 => _310[key], 'optionalAccess', _311 => _311.code]) && _optionalChain([result2, 'access', _312 => _312[key], 'optionalAccess', _313 => _313.code]) > 0
83270
83310
  );
83271
83311
  if (failedProjects.length > 0) {
83272
83312
  throw new Error(
83273
83313
  `The Storm release process was not completed successfully! One or more errors occured while running the \`nx-release-publish\` executor tasks.
83274
83314
 
83275
83315
  Please review the workflow details for the following project(s):
83276
- ${failedProjects.map((failedProject) => ` - ${failedProject} (Error Code: ${_optionalChain([result2, 'access', _313 => _313[failedProject], 'optionalAccess', _314 => _314.code])})`).join("\n")}
83316
+ ${failedProjects.map((failedProject) => ` - ${failedProject} (Error Code: ${_optionalChain([result2, 'access', _314 => _314[failedProject], 'optionalAccess', _315 => _315.code])})`).join("\n")}
83277
83317
  `
83278
83318
  );
83279
83319
  }
@@ -83287,7 +83327,7 @@ async function updatePackageManifests(projectsVersionData, config) {
83287
83327
  let projectGraph;
83288
83328
  try {
83289
83329
  projectGraph = (0, import_devkit2.readCachedProjectGraph)();
83290
- } catch (e18) {
83330
+ } catch (e19) {
83291
83331
  await (0, import_devkit2.createProjectGraphAsync)();
83292
83332
  projectGraph = (0, import_devkit2.readCachedProjectGraph)();
83293
83333
  }
@@ -83295,7 +83335,7 @@ async function updatePackageManifests(projectsVersionData, config) {
83295
83335
  await Promise.all(
83296
83336
  Object.keys(projectsVersionData).map(async (node) => {
83297
83337
  const projectNode = projectGraph.nodes[node];
83298
- if (!_optionalChain([projectNode, 'optionalAccess', _315 => _315.data, 'access', _316 => _316.root])) {
83338
+ if (!_optionalChain([projectNode, 'optionalAccess', _316 => _316.data, 'access', _317 => _317.root])) {
83299
83339
  _chunkXE275LJTcjs.writeWarning.call(void 0,
83300
83340
  `Project node ${node} not found in the project graph. Skipping manifest update.`,
83301
83341
  config
@@ -83303,7 +83343,7 @@ async function updatePackageManifests(projectsVersionData, config) {
83303
83343
  return;
83304
83344
  }
83305
83345
  const versionData = projectsVersionData[node];
83306
- if (_optionalChain([projectNode, 'optionalAccess', _317 => _317.data, 'access', _318 => _318.root]) && versionData && versionData.newVersion !== null) {
83346
+ if (_optionalChain([projectNode, 'optionalAccess', _318 => _318.data, 'access', _319 => _319.root]) && versionData && versionData.newVersion !== null) {
83307
83347
  _chunkXE275LJTcjs.writeTrace.call(void 0,
83308
83348
  `Writing version ${versionData.newVersion} update to manifest file for ${node}
83309
83349
  `,
package/bin/git.js CHANGED
@@ -92267,37 +92267,33 @@ async function resolveTokenData(hostname) {
92267
92267
  );
92268
92268
  }
92269
92269
  async function getGithubReleaseByTag(config, tag) {
92270
- return await makeGithubRequest(
92270
+ return (await makeGithubRequest(
92271
92271
  config,
92272
92272
  `/repos/${config.repo}/releases/tags/${tag}`,
92273
92273
  {}
92274
- );
92274
+ )).data;
92275
92275
  }
92276
92276
  async function makeGithubRequest(config, url2, opts = {}) {
92277
- return (await axios_default(url2, {
92277
+ return await axios_default(url2, {
92278
92278
  ...opts,
92279
92279
  baseURL: config.apiBaseUrl,
92280
92280
  headers: {
92281
92281
  ...opts.headers,
92282
92282
  Authorization: config.token ? `Bearer ${config.token}` : void 0
92283
92283
  }
92284
- })).data;
92284
+ });
92285
92285
  }
92286
92286
  async function createGithubRelease(config, body) {
92287
- return await makeGithubRequest(config, `/repos/${config.repo}/releases`, {
92287
+ return (await makeGithubRequest(config, `/repos/${config.repo}/releases`, {
92288
92288
  method: "POST",
92289
92289
  data: body
92290
- });
92290
+ })).data;
92291
92291
  }
92292
92292
  async function updateGithubRelease(config, id, body) {
92293
- return await makeGithubRequest(
92294
- config,
92295
- `/repos/${config.repo}/releases/${id}`,
92296
- {
92297
- method: "PATCH",
92298
- data: body
92299
- }
92300
- );
92293
+ return (await makeGithubRequest(config, `/repos/${config.repo}/releases/${id}`, {
92294
+ method: "PATCH",
92295
+ data: body
92296
+ })).data;
92301
92297
  }
92302
92298
  function githubNewReleaseURL(config, release) {
92303
92299
  let url2 = `https://${config.hostname}/${config.repo}/releases/new?tag=${release.version}&title=${release.version}&body=${encodeURIComponent(release.body)}&target=${release.commit}`;
@@ -92323,6 +92319,38 @@ async function createGithubRemoteReleaseClient(remoteName = "origin") {
92323
92319
  await resolveTokenData(repoData.hostname)
92324
92320
  );
92325
92321
  }
92322
+ async function isUserAnOrganizationMember(userId, config, remoteName = "origin") {
92323
+ try {
92324
+ const repoData = getGitHubRepoData(remoteName, "github");
92325
+ if (!repoData) {
92326
+ throw new Error(
92327
+ `Unable to validate GitHub actor because the GitHub repo slug could not be determined. Please ensure you have a valid GitHub remote configured.`
92328
+ );
92329
+ }
92330
+ const tokenData = await resolveTokenData(repoData.hostname);
92331
+ if (!tokenData.token) {
92332
+ throw new Error(
92333
+ `Unable to validate GitHub actor because no token was provided. Please set the GITHUB_TOKEN or GH_TOKEN environment variable, or ensure you have an active session via the official gh CLI tool (https://cli.github.com).`
92334
+ );
92335
+ }
92336
+ const result2 = await makeGithubRequest(
92337
+ {
92338
+ repo: repoData.slug,
92339
+ hostname: repoData.hostname,
92340
+ apiBaseUrl: repoData.apiBaseUrl,
92341
+ token: tokenData?.token || null
92342
+ },
92343
+ `/orgs/${config.organization}/members/${userId}`,
92344
+ {}
92345
+ );
92346
+ if (result2.status !== 204) {
92347
+ return false;
92348
+ }
92349
+ return true;
92350
+ } catch {
92351
+ return false;
92352
+ }
92353
+ }
92326
92354
 
92327
92355
  // src/release/changelog.ts
92328
92356
  function createAPI(overrideReleaseConfig) {
@@ -93429,6 +93457,18 @@ var DEFAULT_RELEASE_CONFIG = {
93429
93457
 
93430
93458
  // src/release/run.ts
93431
93459
  var runRelease = async (config, options) => {
93460
+ if (!process.env.GITHUB_ACTOR) {
93461
+ throw new Error("The `GITHUB_ACTOR` environment variable is not set.");
93462
+ }
93463
+ if (!await isUserAnOrganizationMember(process.env.GITHUB_ACTOR, config)) {
93464
+ writeFatal(
93465
+ "You must be a member of the Storm Software organization to run the release process.",
93466
+ config
93467
+ );
93468
+ throw new Error(
93469
+ `The GitHub actor "${process.env.GITHUB_ACTOR}" is not a member of the organization "${config.organization}". Only members of the organization can initiate releases.`
93470
+ );
93471
+ }
93432
93472
  const name = config.bot.name;
93433
93473
  const email = config.bot.email ? config.bot.email : config.bot.name ? `${config.bot.name}@users.noreply.github.com` : "bot@stormsoftware.com";
93434
93474
  process.env.GIT_AUTHOR_NAME = name;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/git-tools",
3
- "version": "2.111.28",
3
+ "version": "2.112.1",
4
4
  "type": "module",
5
5
  "description": "Tools for managing Git repositories within a Nx workspace.",
6
6
  "repository": {