twobulls / danger-plugin-semantic-release

Danger.js plugin that surfaces changelog information about your semantically released npm packages.
Other
3 stars 2 forks source link

Cannot find the package on npm #2

Open thibaudcolas opened 5 years ago

thibaudcolas commented 5 years ago

Hi 👋 this seems like a very useful plugin for people both using Danger and semantic-release! I’d love to use it on my projects – but I can’t seem to find it on npm. Is it not published yet? Anything I can do to help?

The README has a npm badge pointing to https://www.npmjs.com/package/danger-plugin-semantic-release, which is a 404 at the moment.

darcy-rayner commented 5 years ago

Hi @thibaudcolas. Sorry for the late reply. Unfortunately I had some difficulty with semantic-release project not being willing to take on changes which would have enabled this library to work, (from memory it was related to the github token used during a pull request needing excessive permissions), so this repository remains a WIP. I no longer work at Two Bulls, but you are welcome to make a fork and give it a shot.

thibaudcolas commented 5 years ago

Hey @darcy-rayner, thanks for replying!

I’ve tried to get the plugin working, I think what you describe is due to semantic-release always attempting to push to git even in dry-run mode: https://github.com/semantic-release/semantic-release/blob/6b3adf6bbe72d5c32335118e91ca32ec043bbc9e/index.js#L64. This isn’t an issue for my use case, where I would expect the GitHub token to be defined whenever Danger runs, and that token does have rights to push.

I ended up going for a much simpler integration which is enough for my needs – although I’d love to be able to use a package like this WIP, I don’t really have the bandwidth to put that together myself at the moment.

Here’s my integration for future reference, only displaying the predicted next release if there is one:

const { message, schedule } = require("danger")
const semanticRelease = require("semantic-release")
const envCi = require("env-ci")

schedule(async () => {
  // Retrieve the current branch so semantic-release is configured as if it was to make a release from it.
  const { branch } = envCi()

  const result = await semanticRelease({ dryRun: true, branch })
  if (result.nextRelease) {
    message(
      `:tada: Merging this will publish a new ${
        result.nextRelease.type
      } release, v${result.nextRelease.version}.`,
    )
  }
})

For the purpose of this issue, I think it would be good if whoever wants to maintain this project either published the WIP to npm, or otherwise removed example code and the badge for the README that makes it seem like it’s published. Will leave this open in the meantime.