CircleCI-Public / jira-connect-orb

Display the status of CircleCI workflows and deployments in Jira!
https://circleci.com/orbs/registry/orb/circleci/jira
MIT License
25 stars 27 forks source link

Other way of extracting issue keys from the payload data? #5

Closed lubieniebieski closed 5 years ago

lubieniebieski commented 5 years ago

Orb version

1.0.2

What happened

  1. I have the issue key saved in branch name ABC-123-test
    1. I don't really find it useful to repeat issue key name in my commit, but ok, I try:
  2. I have a commit message with multiple lines, when issue key ABC-123is saved in the last line, so it looks like this:
    with multiple lines
    and issue key
    being in the last one (for clarity)
    ABC-123
  3. The subject key in all_commit_details contains only the first line, so there's no way to extract the issue key
  4. As the result I get the message at the end of CircleCI build: {"acceptedBuilds":[],"rejectedBuilds":[{"key":{"pipelineId":"XXX","buildNumber":1},"errors":[{"message":"At least one 'issueKeys' is required"}]}],"unknownIssueKeys":[]}Success!

Expected behavior

I would like the script to extract the data from branch key within all_commit_details first and then try subject (which should contain the entire commit message body).

Please let me know if there's anything to clarify!

eddiewebb commented 5 years ago

I'm not sure accessing the entire payload is viable currently as we need to scan all possible commits for a single build and that can be nuanced from just git commands in different checkout scenarios. This is why we rely on the payload provided by github that summarizes all commits in the push, but is limited to subject only.

Capturing from branch is certainly viable though and an interesting pattern to explore.

iynere commented 5 years ago

v1.0.3 of the orb includes the fix for this