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

Feat: add latest commit sha badge #33

Closed
jdhoffa opened this issue May 7, 2024 · 1 comment · Fixed by #117
Closed

Feat: add latest commit sha badge #33

jdhoffa opened this issue May 7, 2024 · 1 comment · Fixed by #117
Labels

Comments

@jdhoffa
Copy link
Member

jdhoffa commented May 7, 2024

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

Originally posted by @jdhoffa in #32 (comment)

AB#10995

@cjyetman
Copy link
Member

cjyetman commented May 7, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants