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

[GitHubChecksStatus] Add commit check badge #5973

Merged
merged 11 commits into from
Dec 23, 2020
Merged

Conversation

itsvs
Copy link
Contributor

@itsvs itsvs commented Dec 22, 2020

Related to #4364. Adds a badge for Github's commit status endpoint (not quite the same as the check-run endpoints, but similar idea).

@shields-ci
Copy link

shields-ci commented Dec 22, 2020

Messages
📖 ✨ Thanks for your contribution to Shields, @itsvs!

Generated by 🚫 dangerJS against 662b7a3

@lgtm-com
Copy link

lgtm-com bot commented Dec 22, 2020

This pull request introduces 1 alert when merging 7e4ce81 into 91b108d - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

@calebcartwright
Copy link
Member

Thank you for the PR @itsvs. Could you please elaborate on the perceived use case for this badge?

I suppose there's technically a brief window where the status will be unknown/dynamic but this largely becomes a static badge very quickly and I don't quite understand the utility of having a commit hash specific status badge.

Typically the build status-type badges are used to dynamically reflect the current status of project/repository/etc. that changes regularly over time, and the same holds true for the check runs data discussed in #4364. However, the status for a single commit doesn't feel like it really fits into that mold

@itsvs
Copy link
Contributor Author

itsvs commented Dec 22, 2020

Hey @calebcartwright, thanks for taking the time to look over my PR!

I agree that there's little use for a commit-specific badge, but Github's commit status endpoint actually allows for the ref to be a hash, branch, or tag (in the latter two cases it uses the head of the ref, which can change often). The motivation behind this badge is largely similar to that of check-run or CI, but it's for projects that use custom CI and therefore don't have badges available. For example, I'm involved in a couple of projects where we use custom buildservers that report build statuses to Github this way. I was hoping to add a badge to their respective documentations that shows whether the latest commit to master built successfully.

Hope this makes sense!

@calebcartwright
Copy link
Member

Thanks for the additional context, that's most helpful! In that case I think we'll want to pare back the commit-centric focus to be more explicit that any old ref will suffice. I'd suggest potentially updating the route, the internals like the class and file name, as well as examples that demonstrate non-specific commit uses (e.g. branch). We'd also want to have some non-commit hash tests too.

@shields-cd shields-cd temporarily deployed to shields-staging-pr-5973 December 22, 2020 19:31 Inactive
@itsvs
Copy link
Contributor Author

itsvs commented Dec 22, 2020

Makes sense, I'll make those changes later today. Thanks for the input!

@shields-cd shields-cd had a problem deploying to shields-staging-pr-5973 December 23, 2020 02:29 Failure
@shields-cd shields-cd temporarily deployed to shields-staging-pr-5973 December 23, 2020 02:34 Inactive
@shields-cd shields-cd temporarily deployed to shields-staging-pr-5973 December 23, 2020 02:38 Inactive
Copy link
Member

@calebcartwright calebcartwright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for the PR @itsvs! Looks to be in fairly good order overall, and have left some inline feedback for your review. It may seem like a lot of comments, but it's largely just places where Shields has some utils/helpers that should be reused instead of duplicating the functionality those cover 👍

services/github/github-checks-status.service.js Outdated Show resolved Hide resolved
services/github/github-checks-status.service.js Outdated Show resolved Hide resolved
services/github/github-checks-status.service.js Outdated Show resolved Hide resolved
services/github/github-checks-status.service.js Outdated Show resolved Hide resolved
services/github/github-checks-status.service.js Outdated Show resolved Hide resolved
services/github/github-checks-status.service.js Outdated Show resolved Hide resolved
services/github/github-checks-status.tester.js Outdated Show resolved Hide resolved
services/github/github-checks-status.tester.js Outdated Show resolved Hide resolved
.get('/badges/shields/this-ref-does-not-exist.json')
.expectBadge({
label: 'checks',
message: 'invalid ref',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value will likely need to be tweaked to account for changes in the service test for the 404 scenario

@calebcartwright calebcartwright added the service-badge New or updated service badge label Dec 23, 2020
@calebcartwright calebcartwright changed the title [GitHub] Add commit check badge [GitHubChecksStatus] Add commit check badge Dec 23, 2020
@shields-cd shields-cd temporarily deployed to shields-staging-pr-5973 December 23, 2020 19:27 Inactive
@shields-cd shields-cd temporarily deployed to shields-staging-pr-5973 December 23, 2020 19:27 Inactive
@shields-cd shields-cd temporarily deployed to shields-staging-pr-5973 December 23, 2020 19:33 Inactive
@itsvs
Copy link
Contributor Author

itsvs commented Dec 23, 2020

I believe that resolves all your comments, @calebcartwright!

Copy link
Member

@calebcartwright calebcartwright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, thank you!

@shields-cd shields-cd requested a deployment to shields-staging-pr-5973 December 23, 2020 23:08 Abandoned
@repo-ranger repo-ranger bot merged commit d69f7b6 into badges:master Dec 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service-badge New or updated service badge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants