@sous-io/sous 0.2.0 → 0.2.2

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.
@@ -77,7 +77,8 @@ const RELEASE_REMOTE = "origin";
77
77
  *
78
78
  * Two presets sit on top of it. `--check` is read-only and is what a pull
79
79
  * request runs; `--ci` is the non-interactive form a merge runs, which bumps
80
- * nothing because the version was raised in the change being merged.
80
+ * nothing because the version was raised in the change being merged, and which
81
+ * accepts the plan it prints because there is nobody there to accept it.
81
82
  */
82
83
  export default class RepoRelease extends Command {
83
84
  static description =
@@ -106,7 +107,8 @@ export default class RepoRelease extends Command {
106
107
  }),
107
108
  ci: Flags.boolean({
108
109
  description:
109
- "Run the way a merge does: never bump, never ask, and fail on anything unbumped",
110
+ "Run the way a merge does: never bump, accept the plan, never ask, and fail on " +
111
+ "anything unbumped",
110
112
  default: false,
111
113
  }),
112
114
  namespace: Flags.string({
@@ -156,10 +158,14 @@ export default class RepoRelease extends Command {
156
158
  const { flags } = await this.parse(RepoRelease);
157
159
  const dryRun = flags["dry-run"];
158
160
  const ci = flags.ci;
159
- // The CI preset is exactly two settings: never raise a version, and never
160
- // ask. It deliberately does NOT imply --push; the workflow passes that
161
- // itself, so what gets pushed is visible in the workflow file.
161
+ // The CI preset is exactly three settings: never raise a version, accept
162
+ // the plan it prints, and never ask. Accepting the plan is part of the
163
+ // preset because there is nobody to ask: a run that only refused to ask
164
+ // would fail on the very confirmation the preset exists to answer. It
165
+ // deliberately does NOT imply --push; the workflow passes that itself, so
166
+ // what gets pushed is visible in the workflow file.
162
167
  const noBump = flags["no-bump"] || ci;
168
+ const accepted = flags.yes || ci;
163
169
  const interactive = ci ? false : isInteractive();
164
170
 
165
171
  assertFlagsAgree({ ...flags, noBump });
@@ -222,7 +228,7 @@ export default class RepoRelease extends Command {
222
228
 
223
229
  // --- Confirm ----------------------------------------------------------
224
230
 
225
- if (!flags.yes) {
231
+ if (!accepted) {
226
232
  if (!interactive) {
227
233
  throw nonInteractiveError({
228
234
  prompt: "whether to publish the versions listed above",
@@ -232,8 +238,8 @@ export default class RepoRelease extends Command {
232
238
  });
233
239
  }
234
240
  blankLine();
235
- const accepted = await askYesNo("Publish these versions?");
236
- if (!accepted) {
241
+ const answer = await askYesNo("Publish these versions?");
242
+ if (!answer) {
237
243
  blankLine();
238
244
  log(" Nothing was written.");
239
245
  footer();
@@ -332,12 +332,14 @@ export function buildReleaseWorkflow(): string {
332
332
  # declare. It only reads; it never writes, commits or tags. That makes it the
333
333
  # right thing to run on a pull request.
334
334
  #
335
- # 'sous repo release --ci --push' does the same validation and then publishes.
336
- # '--ci' raises no versions and asks no questions: the version bump belongs in
337
- # the change being merged, so a recipe that changed without one fails here
338
- # rather than being given a version nobody reviewed. It cuts an annotated tag
339
- # for every version that does not have one yet, dependency-first, and '--push'
340
- # pushes the commit and those tags.
335
+ # 'sous repo release --ci --push --yes' does the same validation and then
336
+ # publishes. '--ci' raises no versions, accepts the plan it prints, and asks
337
+ # no questions: the version bump belongs in the change being merged, so a
338
+ # recipe that changed without one fails here rather than being given a version
339
+ # nobody reviewed. It cuts an annotated tag for every version that does not
340
+ # have one yet, dependency-first, and '--push' pushes the commit and those
341
+ # tags. '--ci' implies '--yes'; passing it as well keeps this workflow working
342
+ # with a sous old enough that it did not.
341
343
 
342
344
  name: sous release
343
345
 
@@ -385,7 +387,7 @@ jobs:
385
387
  git config user.name "github-actions[bot]"
386
388
  git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
387
389
  - name: Publish every new version
388
- run: npx --yes @sous-io/sous repo release --ci --push
390
+ run: npx --yes @sous-io/sous repo release --ci --push --yes
389
391
  `;
390
392
  }
391
393