-
Notifications
You must be signed in to change notification settings - Fork 3
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
Report URLs of pending status checks #138
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Other than the typo and minor indenting issues I found, looks good to me. 👍
src/Logic.hs
Outdated
-- Sometimes we want to leave an informative comment on the PR. This isn't for things | ||
-- that require uesr feedback like build failures. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
itym user:
-- Sometimes we want to leave an informative comment on the PR. This isn't for things | |
-- that require uesr feedback like build failures. | |
-- Sometimes we want to leave an informative comment on the PR. This isn't for things | |
-- that require user feedback like build failures. |
case integrationStatus pullRequest of | ||
Integrated _ (BuildPending (Just ciUrl)) -> do | ||
span " | " | ||
a ! href (toValue ciUrl) $ "View in CI" | ||
|
||
Integrated _ (BuildFailed (Just ciUrl)) -> do | ||
span " | " | ||
a ! href (toValue ciUrl) $ "View in CI" | ||
|
||
_ -> pure () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome... and pretty handy!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While reading the original issues I found something to improve.
Instead of just "View in CI", maybe it would be better to have: "🟡 build pending" and "❌ build failed " as the link labels for each case. So one can see the status without clicking the links.
NVM, the PRs are already separated by category.
tools/send-webhook
Outdated
event= | ||
commit="$1" | ||
state="$2" | ||
target="$3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code is misaligned here due to a mix of tabs and spaces. Changing the 8 spaces before target to a tab fixes it:
event= | |
commit="$1" | |
state="$2" | |
target="$3" | |
event= | |
commit="$1" | |
state="$2" | |
target="$3" |
tools/send-webhook
Outdated
[ -n "$state" ] || state=success | ||
|
||
# If this is a URL make sure it has quote marks, if null make sure it doesn't. | ||
if [ -z "$target" ]; then | ||
target="null" | ||
else | ||
target="\"$target\"" | ||
fi | ||
|
||
event="status" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code is misaligned here as well due to spaces instead of tabs:
[ -n "$state" ] || state=success | |
# If this is a URL make sure it has quote marks, if null make sure it doesn't. | |
if [ -z "$target" ]; then | |
target="null" | |
else | |
target="\"$target\"" | |
fi | |
event="status" | |
[ -n "$state" ] || state=success | |
# If this is a URL make sure it has quote marks, if null make sure it doesn't. | |
if [ -z "$target" ]; then | |
target="null" | |
else | |
target="\"$target\"" | |
fi | |
event="status" |
event `shouldBe` (BuildStatusChanged (Sha "b26354") Project.BuildPending) | ||
event `shouldBe` (BuildStatusChanged (Sha "b26354") (Project.BuildPending (Just "https://travis-ci.org/rachael/owl/builds/1982"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. The test fixture was already there. :-)
case integrationStatus pullRequest of | ||
Integrated _ (BuildPending (Just ciUrl)) -> do | ||
span " | " | ||
a ! href (toValue ciUrl) $ "View in CI" | ||
|
||
Integrated _ (BuildFailed (Just ciUrl)) -> do | ||
span " | " | ||
a ! href (toValue ciUrl) $ "View in CI" | ||
|
||
_ -> pure () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While reading the original issues I found something to improve.
Instead of just "View in CI", maybe it would be better to have: "🟡 build pending" and "❌ build failed " as the link labels for each case. So one can see the status without clicking the links.
NVM, the PRs are already separated by category.
For this, I think GitHub sends a BuildPending hook again with the build URL when it gets one. But I think you've already figured this out because I saw your changes on send-webhook which deal with this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! (modulo minor fixes)
Btw, I reverted the broken merge of yesterday. So feel free to rebase and merge this into master now if you like. I saw this created a few conflicts with your files (as your change was already based on top of mine). I'm sorry about that 😔. I reviewed the conflicts though, and they seem to be not major. :-) |
dfa71be
to
517632b
Compare
Okay, the rebase was mostly mechanical apart from the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
src/Logic.hs
Outdated
-- Sometimes we want to leave an informative comment on the PR. This isn't for things | ||
-- that require uesr feedback like build failures. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/uesr/user/
-- Sometimes we want to leave an informative comment on the PR. This isn't for things | |
-- that require uesr feedback like build failures. | |
-- Sometimes we want to leave an informative comment on the PR. This isn't for things | |
-- that require user feedback like build failures. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in case anything dumb crept in
Hey look, something dumb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😂 😅
@OpsBotPrime merge on friday |
Pull request approved for merge by @alex-mckenna, rebasing now. |
Rebased as b4994ca, waiting for CI … |
06c6812
to
b4994ca
Compare
This PR allows
hoff
to report thetarget_url
of pending builds, giving users an indication of which jobhoff
is waiting for. This is shown both as a comment on the PR, and an additional link in the headline for pull requests where a CI URL is available (i.e. pending and failed jobs, since we don't currently keep the URL of succeeded jobs).Screenshots:
I'm slightly unsure if this will actually go off in practice. This info is given when the build status changes to pending with a non-null
target_url
, but I have no concrete intuition for when this would occur in practice. I'm hoping when the status check starts it will change the state fromBuildPending Nothing
toBuildPending (Just url)
.Closes #26
Closes #109