-
Notifications
You must be signed in to change notification settings - Fork 599
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
add support for Bitbucket Pipelines badges (Shields.io) #1934
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { computed } from '@ember/object'; | ||
import { alias } from '@ember/object/computed'; | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
tagName: 'span', | ||
classNames: ['badge'], | ||
repository: alias('badge.attributes.repository'), | ||
branch: computed('badge.attributes.branch', function() { | ||
return encodeURIComponent(this.get('badge.attributes.branch')); | ||
}), | ||
text: computed('badge.attributes.branch', function() { | ||
const branch = this.get('badge.attributes.branch'); | ||
return `Bitbucket Pipelines build status for the ${branch} branch`; | ||
}), | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<a href="https://bitbucket.org/{{ repository }}/addon/pipelines/home#!/results/branch/{{ branch }}/page/1"> | ||
<img | ||
src="https://img.shields.io/bitbucket/pipelines/{{ repository }}/{{ branch }}" | ||
alt="{{ text }}" | ||
title="{{ text }}"> | ||
</a> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,10 @@ pub enum Badge { | |
branch: Option<String>, | ||
service: Option<String>, | ||
}, | ||
BitbucketPipelines { | ||
repository: String, | ||
branch: String, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’ve made the branch attribute required for now, because while Shields.io allows the branch to be omitted, it assumes the default branch is “master”, but Bitbucket lets you choose any branch as the default branch There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (strictly speaking, this is a bug that Shields.io could fix by querying the Bitbucket API for the repository’s main branch, but that’s a job for another day) |
||
}, | ||
Maintenance { | ||
status: MaintenanceStatus, | ||
}, | ||
|
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.
the URL encoding is mandatory (e.g. this link doesn’t work)