about summary refs log tree commit diff
path: root/users
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-09-14T17·10-0400
committerglittershark <grfn@gws.fyi>2020-09-14T17·12+0000
commit94c7990d578fea42c0b9b202e164f9a0460570b8 (patch)
tree70fad6f3ad511aaf6a894ed3f65c384865cd3a66 /users
parenteb11cced9dfdc6ce965dc15b788d2cd786f154f0 (diff)
feat(gs/emacs): Link created PR to clocked in item r/1789
After creating a pull request link it to the currently clocked in
org-mode headline if any.

Change-Id: I75d7e70316494e355e11864496fdfc8b9e3009e1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1979
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to 'users')
-rw-r--r--users/glittershark/emacs.d/org-config.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/users/glittershark/emacs.d/org-config.el b/users/glittershark/emacs.d/org-config.el
index 9885a8e3c97a..c72a7c968710 100644
--- a/users/glittershark/emacs.d/org-config.el
+++ b/users/glittershark/emacs.d/org-config.el
@@ -144,3 +144,19 @@
 
 ;;; TODO: this doesn't work?
 (define-auto-insert "\\.org?$" #'grfn/insert-org-template t)
+
+(defun forge--post-submit-around---link-pr-to-org-item
+    (orig)
+  (let ((cb (funcall orig)))
+    (lambda (value headers status req)
+      (prog1 (funcall cb value headers status req)
+        (grfn/at-org-clocked-in-item
+         (let ((url (alist-get 'url value))
+               (number (alist-get 'number value)))
+           (org-set-property
+            "pull-request"
+            (org-make-link-string url (number-to-string number)))))))))
+
+(advice-add
+ #'forge--post-submit-callback
+ :around #'forge--post-submit-around---link-pr-to-org-item)