qiwi / multi-semantic-release

Proof of concept that wraps semantic-release to work with monorepos.
BSD Zero Clause License
86 stars 34 forks source link

--no-ci doesn't seem to get passed through to semantic-release #81

Open Twipped opened 2 years ago

Twipped commented 2 years ago

Issue type

Expected behavior

Invoking MSR with --no-ci --dry-run when running in a github action should bypass the CI checks and perform a dry-run for the repo.

Actual behavior

Each package fails, complaining that it is happening in a pull request. (This error).

> multi-semantic-release --deps.bump=inherit --no-ci --dry-run
multi-semantic-release version: 6.5.1
semantic-release version: 19.0.3
flags: {
  "sequentialInit": false,
  "sequentialPrepare": true,
  "firstParent": false,
  "debug": false,
  "ignorePrivate": true,
  "ignorePackages": [],
  "tagFormat": "${name}@${version}",
  "dryRun": true,
  "deps": {
    "bump": "inherit",
    "release": "patch",
    "prefix": ""
  },
  "ci": false
}
package paths [
  '/home/runner/work/redacted/redacted/packages/__tests__/package.json',
  '/home/runner/work/redacted/redacted/packages/analytics/package.json',
  '/home/runner/work/redacted/redacted/packages/hooks/package.json',
  '/home/runner/work/redacted/redacted/packages/intercom/package.json',
  '/home/runner/work/redacted/redacted/packages/utils/package.json'
]
[3:24:46 PM] › 🎉  Started multirelease! Loading 5 packages...
[3:24:47 PM] › ✔  Loaded package @redacted/redacted-repo-tests
[3:24:47 PM] › ✔  Loaded package @redacted/package-1
[3:24:47 PM] › ✔  Loaded package @redacted/package-2
[3:24:47 PM] › ✔  Loaded package @redacted/package-3
[3:24:47 PM] › ✔  Loaded package @redacted/package-4
[3:24:47 PM] › 🎉  Queued 4 packages! Starting release...
[3:24:47 PM] [@redacted/package-1] › ℹ  Running semantic-release version 19.0.3
[3:24:47 PM] [@redacted/package-1] › ✔  Loaded plugin "addChannel" from "@semantic-release/npm"
[3:24:47 PM] [@redacted/package-1] › ✔  Loaded plugin "addChannel" from "@semantic-release/github"
[3:24:47 PM] [@redacted/package-1] › ✔  Loaded plugin "success" from "@semantic-release/github"
[3:24:47 PM] [@redacted/package-1] › ✔  Loaded plugin "fail" from "@semantic-release/github"
[3:24:47 PM] [@redacted/package-1] › ℹ  This run was triggered by a pull request and therefore a new version won't be published.
[3:24:47 PM] [@redacted/package-3] › ℹ  Running semantic-release version 19.0.3
[3:24:47 PM] [@redacted/package-3] › ✔  Loaded plugin "addChannel" from "@semantic-release/npm"
[3:24:47 PM] [@redacted/package-3] › ✔  Loaded plugin "addChannel" from "@semantic-release/github"
[3:24:47 PM] [@redacted/package-3] › ✔  Loaded plugin "success" from "@semantic-release/github"
[3:24:47 PM] [@redacted/package-3] › ✔  Loaded plugin "fail" from "@semantic-release/github"
[3:24:47 PM] [@redacted/package-3] › ℹ  This run was triggered by a pull request and therefore a new version won't be published.
[3:24:47 PM] [@redacted/package-4] › ℹ  Running semantic-release version 19.0.3
[3:24:47 PM] [@redacted/package-4] › ✔  Loaded plugin "addChannel" from "@semantic-release/npm"
[3:24:47 PM] [@redacted/package-4] › ✔  Loaded plugin "addChannel" from "@semantic-release/github"
[3:24:47 PM] [@redacted/package-4] › ✔  Loaded plugin "success" from "@semantic-release/github"
[3:24:47 PM] [@redacted/package-4] › ✔  Loaded plugin "fail" from "@semantic-release/github"
[3:24:47 PM] [@redacted/package-4] › ℹ  This run was triggered by a pull request and therefore a new version won't be published.
[3:24:47 PM] [@redacted/package-2] › ℹ  Running semantic-release version 19.0.3
[3:24:47 PM] [@redacted/package-2] › ✔  Loaded plugin "addChannel" from "@semantic-release/npm"
[3:24:47 PM] [@redacted/package-2] › ✔  Loaded plugin "addChannel" from "@semantic-release/github"
[3:24:47 PM] [@redacted/package-2] › ✔  Loaded plugin "success" from "@semantic-release/github"
[3:24:47 PM] [@redacted/package-2] › ✔  Loaded plugin "fail" from "@semantic-release/github"
[3:24:47 PM] [@redacted/package-2] › ℹ  This run was triggered by a pull request and therefore a new version won't be published.
[3:24:47 PM] › 🎉  Released 0 of 4 packages, semantically!

Steps to reproduce

Run the following in a pull request github workflow for a monorepo. multi-semantic-release --no-ci --dry-run

Specifications

antongolub commented 2 years ago

@Twipped, thanks for highlighting this issue.

It seems related to this change: https://github.com/qiwi/multi-semantic-release/pull/80/files#diff-b9b135fc5b2b57179765a193f56284025893d03b8c6f250c75c03c2a97ad4d0dR196

Would you try to fix it?

Twipped commented 2 years ago

I’ll give it a shot.

On Jun 21, 2022, at 1:35 PM, Anton Golub @.***> wrote:

@Twipped https://github.com/Twipped, thanks for highlighting this issue.

It seems related to this change: https://github.com/qiwi/multi-semantic-release/pull/80/files#diff-b9b135fc5b2b57179765a193f56284025893d03b8c6f250c75c03c2a97ad4d0dR196 https://github.com/qiwi/multi-semantic-release/pull/80/files#diff-b9b135fc5b2b57179765a193f56284025893d03b8c6f250c75c03c2a97ad4d0dR196 Will you try to fix it?

— Reply to this email directly, view it on GitHub https://github.com/qiwi/multi-semantic-release/issues/81#issuecomment-1162317827, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABYN5MW2PFWYTEVCTSJ34TVQIRQ7ANCNFSM5ZMZR7UQ. You are receiving this because you were mentioned.

Twipped commented 2 years ago

It does appear that the removal of ...flags on line 183 was the culpret. I was able to confirm that adding the following to index.js at line 205 solved the passthru:

    // - ci should use the msr version if specified, otherwise fallback to semrel
    options.ci = flags.ci === undefined ? options.ci : flags.ci;

However, once I got past that issue I ran into numerous other blockers in SR itself that made this experiment too difficult. I had been hoping to make a workflow that would output what releases a PR would trigger, but SR has so many safety checks against accidentally running on the wrong branch that I couldn't even get it to do a commit analysis. With that, I can't justify spending any more time on this.

BTW, I also noticed that branches isn't getting passed through either. I solved that by adding castArray from lodash and putting this line in as well:

    options.branches = flags.branches ? castArray(flags.branches) : options.branches;
antongolub commented 2 years ago

@Twipped, np, thanks for the digging. We will continue this work.

pismenskiy commented 2 years ago

hi! I started working on this issue