{"action":"created","issue":{"url":"https://api.github.com/repos/djcb/mu/issues/517","labels_url":"https://api.github.com/repos/djcb/mu/issues/517/labels{/name}","comments_url":"https://api.github.com/repos/djcb/mu/issues/517/comments","events_url":"https://api.github.com/repos/djcb/mu/issues/517/events","html_url":"https://github.com/djcb/mu/issues/517","id":49791364,"number":517,"title":"Action for opening GitHub pull requests","user":{"login":"stefanv","id":45071,"avatar_url":"https://avatars.githubusercontent.com/u/45071?v=3","gravatar_id":"","url":"https://api.github.com/users/stefanv","html_url":"https://github.com/stefanv","followers_url":"https://api.github.com/users/stefanv/followers","following_url":"https://api.github.com/users/stefanv/following{/other_user}","gists_url":"https://api.github.com/users/stefanv/gists{/gist_id}","starred_url":"https://api.github.com/users/stefanv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefanv/subscriptions","organizations_url":"https://api.github.com/users/stefanv/orgs","repos_url":"https://api.github.com/users/stefanv/repos","events_url":"https://api.github.com/users/stefanv/events{/privacy}","received_events_url":"https://api.github.com/users/stefanv/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2014-11-22T13:48:32Z","updated_at":"2015-07-08T02:59:08Z","closed_at":null,"body":"I often get GitHub pull request notifications, so I wrote an action to open the PR url.  Not sure if this would be useful to anyone, but if so I'd be happy to submit a PR:\r\n\r\n```elisp\r\n(defun stefan/mu4e-action-view-pull-request (msg)\r\n  \"Locate a GitHub pull request URL and open in the browser.\r\nThe browser used is specified in `browse-url-generic-program'.\"\r\n  (let* ((txt (mu4e-message-field msg :body-txt))\r\n         (pr-re \"^https://github.com/.*[[:digit:]]+$\"))\r\n    (unless txt\r\n      (mu4e-error \"No text part for this message\"))\r\n\r\n    (set-match-data nil)\r\n\r\n    (while (and\r\n            ;; search for the next url, starting from the position of\r\n            ;; the last one found\r\n            (string-match mu4e-view-url-regexp txt (match-end 0))\r\n            ;; we use save-match-data to protect the last search\r\n            ;; position, which is needed for the string-match call\r\n            ;; above\r\n            ;;\r\n            ;; abort the loop if a matching url is found\r\n            (save-match-data\r\n              (not (string-match pr-re (match-string 0 txt))))))\r\n\r\n    (let ((url (match-string 0 txt)))\r\n      (if (string-match pr-re url)\r\n          (browse-url url)\r\n        (mu4e-error \"No pull request URL found\")))))\r\n```\r\n\r\nInstall using:\r\n\r\n```\r\n(add-to-list 'mu4e-view-actions\r\n   '(\"pull request\" . mu4e-action-view-pull-request) t)\r\n```"},"comment":{"url":"https://api.github.com/repos/djcb/mu/issues/comments/119406364","html_url":"https://github.com/djcb/mu/issues/517#issuecomment-119406364","issue_url":"https://api.github.com/repos/djcb/mu/issues/517","id":119406364,"user":{"login":"djcb","id":199741,"avatar_url":"https://avatars.githubusercontent.com/u/199741?v=3","gravatar_id":"","url":"https://api.github.com/users/djcb","html_url":"https://github.com/djcb","followers_url":"https://api.github.com/users/djcb/followers","following_url":"https://api.github.com/users/djcb/following{/other_user}","gists_url":"https://api.github.com/users/djcb/gists{/gist_id}","starred_url":"https://api.github.com/users/djcb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djcb/subscriptions","organizations_url":"https://api.github.com/users/djcb/orgs","repos_url":"https://api.github.com/users/djcb/repos","events_url":"https://api.github.com/users/djcb/events{/privacy}","received_events_url":"https://api.github.com/users/djcb/received_events","type":"User","site_admin":false},"created_at":"2015-07-08T02:59:08Z","updated_at":"2015-07-08T02:59:08Z","body":"@stefanv: right now it doesn't seem to add too much over mu4e's built-in jump-to-url functionality; but perhaps it could be the start of some more extensive github action."}}