Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign labels/milestones when creating an issue/MR in Magit Forge #398

Open
philsf opened this issue Sep 3, 2021 · 3 comments
Open

Assign labels/milestones when creating an issue/MR in Magit Forge #398

philsf opened this issue Sep 3, 2021 · 3 comments
Labels
area: topic info enhancement New feature or request

Comments

@philsf
Copy link

philsf commented Sep 3, 2021

It would be nice to be able to assign labels and/or milestones when creating an issue or merge request in Magit Forge. Both forges I know (github and gitlab) offer this feature on the web UI, which simplifies workflows.

On github I currently have to create the topic, and then edit it twice (once for labels, then for milestones). Every one of those steps requires a new fetch.

I was hoping for a way to do all that in the same buffer for topic creation (and do a single topic fetch).

@philsf
Copy link
Author

philsf commented Sep 3, 2021

Asked first on emacs@SE: https://emacs.stackexchange.com/questions/68370/

@tarsius tarsius added the enhancement New feature or request label Sep 4, 2021
@tarsius
Copy link
Member

tarsius commented Sep 4, 2021

Eventually I will likely implement this but it is not a high priority.

@felipeochoa
Copy link

felipeochoa commented Oct 21, 2021

As mentioned in the SE answer, for Gitlab you can use quick actions to assign labels. Here's what I'm using to insert these easily in a new issue buffer:

(defvar fov/forge-insert-labels-hist)

(defun fov/forge-insert-labels ()
  "Insert a /labels quick action."
  (interactive)
  (let ((repo (forge-get-repository nil))
        (crm-separator ","))
    (when (null repo) (error "Repo not found -- is this a new issue buffer?"))
    (when-let (labels (magit-completing-read-multiple*
                       "Labels: "
                       (mapcar #'cadr (oref repo labels))
                       nil t nil 'fov/forge-insert-labels-hist))
      (insert "/label "
              (mapconcat (lambda (label)
                           (if (string-match-p "^[a-zA-Z0-9_?.&-]+$" label)
                               (concat "~" label)
                             (concat "~\"" label "\"")))
                         labels
                         " ")))))

;; Warning, clobbers a markdown mode binding
(define-key forge-post-mode-map (kbd "C-c C-l") #'fov/forge-insert-labels)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: topic info enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants