go-jira / jira

simple jira command line client in Go
Apache License 2.0
2.68k stars 327 forks source link

How to create a ticket that's on our project board? #338

Open zenspider opened 4 years ago

zenspider commented 4 years ago

I want to create a bunch of tix directly into our "To Do" column of our board. We have "backlog" set to on in the project settings and as such, all tix (despite state="to do") wind up in backlog. I even manually moved one into our project and diffed the json output of json view and got roughly nothing (except cryptic customfield_12500). Trying to set that custom field yielded nothing.

matt-canty-dragon commented 4 years ago

I have similar issue in that all tickets are created on the backlog. But all those who are not developers have been looking at the board and wondering what I have been up to.

I can't seem to find a way of moving an issue onto the board using go-jira, if there was/is then I can add it to my work-on alias.

zenspider commented 4 years ago

Sadly... this project seems to have stalled.

svenXY commented 4 years ago

For me, to add it to a Scrum board, the following works:

  - name: quick-create-sprint
    aliases:
        - qcs
    help: Create a teamtask ticket, assign it to yourself, add it to the sprint and start it
    args:
      - name: SUMMARY
        short: sum
        default: quick teamtask
        repeat: true
    script: |
      # only if not using keyring
      # {{jira}} login --quiet
      me=$(whoami)
      board_id=1001
      sprint_id=$({{jira}} req "/rest/agile/1.0/board/$board_id/sprint?state=active" --gjq values.0.id)
      re='^[0-9]+$'
      if ! [[ $sprint_id =~ $re ]] ; then
         echo "error: Could not retrieve current sprint" >&2; exit 1
      else
         ticket_id=$({{jira}} create -i Teamtask --noedit -o "assignee=$me" -o "summary={{range $summary := args.SUMMARY}}{{$summary}} {{end}}" | cut -d' ' -f2)
         {{jira}} transition "in Arbeit" -Q --noedit $ticket_id > /dev/null
         {{jira}} req -t nothing -M POST "/rest/agile/1.0/sprint/$sprint_id/issue" "{\"issues\":[\"$ticket_id\"]}" >/dev/null 2>&1
         echo $ticket_id
      fi

and for a Kanban board, use this:

  - name: quick-create
    aliases:
        - qc
    help: Create a teamtask ticket, assign it to yourself and start it
    args:
      - name: SUMMARY
        short: sum
        default: quick teamtask
        repeat: true
    script: |
      # only if not using keyring
      # {{jira}} login --quiet
      me=$(whoami)
      ticket_id=$({{jira}} create -i Teamtask --noedit -o "assignee=$me" -o "summary={{range $summary := args.SUMMARY}}{{$summary}} {{end}}" | cut -d' ' -f2)
      {{jira}} transition "in Arbeit" -Q --noedit $ticket_id > /dev/null
      if [ -f /usr/bin/pbcopy ]; then
          echo $ticket_id | pbcopy
          echo $ticket_id copied to clipboard
      else
          echo $ticket_id
      fi

You will have to adjust the transition names and board IDs

zenspider commented 4 years ago

That feels like a workaround at best.

This project feels like is beyond stalled out at this point. I'm leaving this open, but unsubscribing from it.

nyarly commented 2 years ago

The Kanban approach above doesn't work - Jira tasks can have statuses separate from their being on the board or not.