Skip to content

Handle Gitlab closing comma separated actions #37

Description

@angelkenneth

Parser configuration

const issueParser = require('issue-parser');
const parse = issueParser('gitlab');

Text to parse

From: Managing Issues > Default closing pattern

Awesome commit message

Fix #20, Fixes #21 and Closes group/otherproject#22.
This commit is also related to #17 and fixes #18, #19
and https://gitlab.com/group/otherproject/issues/23.

Current Behavior

{
  "actions": {
    "close": [
      {
        "raw": "Fix #20",
        "action": "Fix",
        "prefix": "#",
        "issue": "20"
      },
      {
        "raw": "Fixes #21",
        "action": "Fixes",
        "prefix": "#",
        "issue": "21"
      },
      {
        "raw": "Closes group/otherproject#22",
        "action": "Closes",
        "slug": "group/otherproject",
        "prefix": "#",
        "issue": "22"
      },
      {
        "raw": "fixes #18",
        "action": "Fixes",
        "prefix": "#",
        "issue": "18"
      }
    ],
    "duplicate": []
  },
  "refs": [
    {
      "raw": "#17",
      "prefix": "#",
      "issue": "17"
    },
    {
      "raw": "#19",
      "prefix": "#",
      "issue": "19"
    },
    {
      "raw": "https://gitlab.com/group/otherproject/issues/23",
      "slug": "group/otherproject",
      "issue": "23"
    }
  ],
  "mentions": []
}

Expected behavior

Issue 19 and 23 should be interpreted as close.

If it helps, their parser code is at: closing_issue_extractor.rb

{
  "actions": {
    "close": [
      {
        "raw": "Fix #20",
        "action": "Fix",
        "prefix": "#",
        "issue": "20"
      },
      {
        "raw": "Fixes #21",
        "action": "Fixes",
        "prefix": "#",
        "issue": "21"
      },
      {
        "raw": "Closes group/otherproject#22",
        "action": "Closes",
        "slug": "group/otherproject",
        "prefix": "#",
        "issue": "22"
      },
      {
        "raw": "fixes #18",
        "action": "Fixes",
        "prefix": "#",
        "issue": "18"
      },
      {
        "raw": "#19",
        "prefix": "#",
        "issue": "19"
      },
      {
        "raw": "https://gitlab.com/group/otherproject/issues/23",
        "slug": "group/otherproject",
        "issue": "23"
      }
    ],
    "duplicate": []
  },
  "refs": [
    {
      "raw": "#17",
      "prefix": "#",
      "issue": "17"
    },
    {
      "raw": "#19",
      "prefix": "#",
      "issue": "19"
    },
    {
      "raw": "https://gitlab.com/group/otherproject/issues/23",
      "slug": "group/otherproject",
      "issue": "23"
    }
  ],
  "mentions": []
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions