dhoulb / multi-semantic-release

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

Newly added packages update all issues and prs in the history #90

Open esatterwhite opened 3 years ago

esatterwhite commented 3 years ago

when a new packages is added to an existing monorepo the initial release of the package results in adding the release success comment on every PR/Issue before it.

The commits aren't filtered. It updates months worth of Pull requests + Issues, and GitHub sends out dozens of email notifications

It seems something went wrong here. https://github.com/semantic-release/github/blob/d70e766d275b856dbe95f48358dcb9e6025748a7/lib/success.js#L43

  } else {
    const parser = issueParser('github', githubUrl ? {hosts: [githubUrl]} : {});
    const releaseInfos = releases.filter((release) => Boolean(release.name));
    const shas = commits.map(({hash}) => hash);

    const searchQueries = getSearchQueries(`repo:${owner}/${repo}+type:pr+is:merged`, shas).map(
      async (q) => (await github.search.issuesAndPullRequests({q})).data.items
    );

We need to debug this point to make sure, that only filtered commits are passed to plugin method.

Originally posted by @antongolub in https://github.com/dhoulb/multi-semantic-release/issues/41#issuecomment-982402576

esatterwhite commented 3 years ago

The logs out put this on a new package › ℹ Found 233 commits since last release There should not be any commits since the last release - there wasn't one for a new package

esatterwhite commented 3 years ago

There look to be a couple of places the success hook could be called

https://github.com/semantic-release/semantic-release/blob/b64855fc57e2ab5ded02ddc939fc369ef082ec84/index.js#L134

    } else {
      const commits = await getCommits({...context, lastRelease, nextRelease});
      nextRelease.notes = await plugins.generateNotes({...context, commits, lastRelease, nextRelease});

      if (options.dryRun) {
        logger.warn(`Skip ${nextRelease.gitTag} tag creation in dry-run mode`);
      } else {
        await addNote({channels: [...currentRelease.channels, nextRelease.channel]}, nextRelease.gitHead, {cwd, env});
        await push(options.repositoryUrl, {cwd, env});
        await pushNotes(options.repositoryUrl, {cwd, env});
        logger.success(
          `Add ${nextRelease.channel ? `channel ${nextRelease.channel}` : 'default channel'} to tag ${
            nextRelease.gitTag
          }`
        );
      }

      context.branch.tags.push({
        version: nextRelease.version,
        channel: nextRelease.channel,
        gitTag: nextRelease.gitTag,
        gitHead: nextRelease.gitHead,
      });

      const releases = await plugins.addChannel({...context, commits, lastRelease, currentRelease, nextRelease});
      context.releases.push(...releases);
      await plugins.success({...context, lastRelease, commits, nextRelease, releases});
    }

and

https://github.com/semantic-release/semantic-release/blob/b64855fc57e2ab5ded02ddc939fc369ef082ec84/index.js#L201

  const releases = await plugins.publish(context);
  context.releases.push(...releases);

  await plugins.success({...context, releases});

the first one isn't passing the commits array that is on the context object. If I had to take a wild guess, its probably happening there

esatterwhite commented 2 years ago

@antongolub this one is really rather problematic. Any chance you might be able to look at this?

antongolub commented 2 years ago

@esatterwhite,

Ok, I will dig this issue next week, but I cannot promise a quick fix. We really have a lot of work to do right now, sorry.

esatterwhite commented 2 years ago

@antongolub friendly check in 😄

antongolub commented 2 years ago

My recipe for success in GTD is procrastination and multitasking :((

esatterwhite commented 2 years ago

Any traction here? Everytime I add a new package everyone in my org gets hammered with 500 emails. I'm also worries that this is going to kill out git hub access throu CI and we will start getting rate limited wich would break the build process for every project in the org

esatterwhite commented 2 years ago

@antongolub re-nudge.

antongolub commented 2 years ago

@esatterwhite

I'm so sorry, but I have no resources left for volunteer projects at this moment. Hope that someone else will be able to continue this work.

esatterwhite commented 1 year ago

I'm so sorry, but I have no resources left for volunteer projects at this moment. Hope that someone else will be able to continue this work.

how about now? 😄

antongolub commented 1 year ago

I'm afraid, the situation with available time is only getting worse.