message: [Dev] Let danger set issue labels for a PR
diff: @@ -48,15 +48,6 @@ if (pr.body.length === 0) {
  fail("Please add a description to your PR.")
  }
  -// Warn if there are changes to package.json without changes to yarn.lock.
  -const packageChanged = includes(modified, "package.json")
  -const lockfileChanged = includes(modified, "yarn.lock")
  -if (packageChanged && !lockfileChanged) {
  - const message = "Changes were made to package.json, but not to yarn.lock"
  - const idea = "Perhaps you need to run `yarn install`?"
  - warn(`${message} - <i>${idea}</i>`)
  -}
  -
  // Always ensure we assign someone, so that our Slackbot can do its work correctly
  if (pr.assignee === null) {
  const method = pr.title.includes("WIP") ? warn : fail
  @@ -198,3 +189,22 @@ ${errors.join("\n")}
  // Check for dependency changes
  import yarn from "danger-plugin-yarn"
  schedule(yarn())
  +
  +// List available at https://github.com/artsy/emission/labels
  +const labelMatches = {
  + Consignments: "Consignments",
  + MSG: "Messaging",
  + Messaging: "Messaging",
  + Auctions: "Auctions",
  +}
  +
  +// If you include any of the above keys in a commit in [], e.g. `[Consignments]`
  +// then the PR should be updated with the label providing context
  +const commitLabels = danger.git.commits
  + .map(c => c.message)
  + .filter(m => m.startsWith("[") && m.includes("]"))
  + .map(m => m.match(/\[(.*)\]/)[1])
  +
  +const labels = compact(uniq(commitLabels).map(l => labelMatches[l]))
  +const github = danger.github
  +schedule(() => github.api.issues.addLabels({ ...github.thisPR, labels }))
  