question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Now CI badge

See original GitHub issue

It might sounds crazy, but it’s truly beautiful to use it as CI/CD 😄

How?

now.json

{
  "version": 2,
  "name": "tunnckocore-template",
  "builds": [{ "src": "package.json", "use": "@now/static-build" }]
}

and define now-build script

"scripts": {
  "lint": "yarn scripts devest lint",
  "test": "yarn scripts devest test",
  "build": "yarn scripts pika-pack build --out dist",
  "status:pass": "badgen --subject build --status passing --color green > dist/badge.svg",
  "status:fail": "badgen --subject build --status failing --color red > dist/badge.svg",
  "pkg": "yarn lint && yarn test && yarn build",
  "now-build": "(yarn pkg && yarn status:pass) || yarn status:fail"
},

The thing is, that when build fails, it actually doesn’t publish the contents of dist/ so we can’t just get the generated failing badge. For now I can just point the badge to https://<myrepo>.<my-zeit-username>.now.sh/badge.svg

So, the alternatively we can have it here, and query directly the API with https://zeit.co/docs/api#endpoints/deployments/list-deployments and get the first item from the data.deployments[0].state We’ll need the deployment “name” and fitler by it and after that get the first item. But, sadly, the API endpoint wants a token, which might be a problem, because we also have some rate limits there. But we have caching here, right? So it won’t be a problem?

I can PR, but we’ll need to add a token to the secrets.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:26 (26 by maintainers)

github_iconTop GitHub Comments

5reactions
amiocommented, Jun 17, 2019

That’s brilliant, almost worked 😂

+1 on the github way

3reactions
amiocommented, Jun 21, 2019

Just realize that we already have the combined status badge 😂 with exactly this schema:

/github/:topic<status>/:owner/:repo/:ref?
Read more comments on GitHub >

github_iconTop Results From Across the Web

CI Solutions + Clever Badges
With just a few clicks, you can now print your Clever Badges on your CI Solutions generated student IDs. CI Solutions + Clever...
Read more >
ID Card Printing Software | CI Solutions
Our card printing software, CI Badge, is customized to your specific card printing needs. Learn more about our solution with a demo today....
Read more >
Activate Badge Reader Integration
The Badge Reader Integration application is a framework enabling other applications, such as Walk-up Experience, to integrate with badge reader ...
Read more >
Build Status Badges now Support SVG - The Travis CI Blog
As of today, badges displayed in Travis CI are based on the SVG version, and our status image dialog shows them as defaults...
Read more >
Support custom text for coverage badges - GitLab.org
add support for providing description: to job in .gitlab-ci.yml (we already have a table in the database, as far as I remember, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found