RMI-PACTA / pacta.sit.rep

A simple situation report of the overall code health of the PACTA ecosystem.
Other
0 stars 0 forks source link

Feat: add latest commit sha badge #33

Open jdhoffa opened 3 months ago

jdhoffa commented 3 months ago

Cool tip with the latest commit SHA badge though! Gonna consider adding that

Originally posted by @jdhoffa in https://github.com/RMI-PACTA/pacta.sit.rep/pull/32#issuecomment-2097191265

AB#10995

cjyetman commented 3 months ago

utilizing GitHub API and shield.io

https://api.github.com/repos/rmi-pacta/pacta.portfolio.utils/git/refs/heads/main returns

{
  "ref": "refs/heads/main",
  "node_id": "REF_kwDOJd1yoq9yZWZzL2hlYWRzL21haW4",
  "url": "https://api.github.com/repos/RMI-PACTA/pacta.portfolio.utils/git/refs/heads/main",
  "object": {
    "sha": "e619ad27b3606b61f44d203fab2bc55c897c8bf4",
    "type": "commit",
    "url": "https://api.github.com/repos/RMI-PACTA/pacta.portfolio.utils/git/commits/e619ad27b3606b61f44d203fab2bc55c897c8bf4"
  }
}

and the sha from that can be targeted by its object name object.sha in a shields.io dynamic JSON badge

https://img.shields.io/badge/dynamic/json?color=orange&label=latest%20commit&query=object.sha&url=https%3A%2F%2Fapi.github.com%2Frepos%2Frmi-pacta%2Fpacta.portfolio.utils%2Fgit%2Frefs%2Fheads%2Fmain