Skip to content

Commit 47061a0

Browse files
quicklispxach
authored andcommitted
Add failtail to irepl, fix up cantbuild to leave a comment on the issue with the log
1 parent 502ff20 commit 47061a0

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

git.lisp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@
3939
(run "git" "commit" "-m" message))
4040
(list :committed (name source) :with message)))
4141

42+
(defmacro with-issue-number ((var source) &body body)
43+
(let ((source-var (copy-symbol 'source)))
44+
`(let* ((,source-var (source-designator ,source))
45+
(,var (github-issue-number ,source-var)))
46+
(unless ,var
47+
(error "Can't find issue number for ~A" ,source-var))
48+
,@body)))
49+
4250
(defun set-issue-label (source label)
4351
(setf source (source-designator source))
4452
(let ((issue-number (github-issue-number source)))
@@ -49,6 +57,13 @@
4957
:number issue-number
5058
:body (githappy:js "labels" (list label)))))
5159

60+
(defun comment-on-issue (source comment)
61+
(with-issue-number (number source)
62+
(githappy:create-repo-issue-comment :body (githappy:js "body" comment)
63+
:issue-number number
64+
:repo "quicklisp-projects"
65+
:owner "quicklisp")))
66+
5267
(defun mark-canbuild (source)
5368
(set-issue-label source "canbuild"))
5469

irepl.lisp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,15 @@
126126

127127
(define-irepl-command skip
128128
(let ((index (position-if-not (=jref '("labels" :* "name"))
129-
(all-issues *irepl-state*))))
129+
(all-issues *irepl-state*))))
130130
(if index
131-
(progn
132-
(setf (issue-index *irepl-state*) index)
133-
(invoke-irepl-command 'show))
134-
(format t "; No issue without labels~%"))))
131+
(progn
132+
(setf (issue-index *irepl-state*) index)
133+
(invoke-irepl-command 'show))
134+
(format t "; No issue without labels~%"))))
135+
136+
(define-irepl-command failtail
137+
(failtail))
135138

136139
(defvar *irepl-guess-patterns*
137140
"https://github.com/")
@@ -142,9 +145,15 @@
142145
:canbuild))
143146

144147
(define-irepl-command cantbuild
145-
(when *last-source*
146-
(mark-cantbuild *last-source*)
147-
:cantbuild))
148+
(cond (*last-source*
149+
(mark-cantbuild *last-source*)
150+
(let ((log-url (publish-source-failure *last-source*)))
151+
(comment-on-issue *last-source*
152+
(format nil "Failure log here: ~A"
153+
log-url)))
154+
:cantbuild)
155+
(t
156+
(warn "No last-source defined"))))
148157

149158
(define-irepl-command commit
150159
(when *last-source*

0 commit comments

Comments
 (0)