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

🌱 viewer: display scorecard version, API results URL #597

Merged
merged 14 commits into from
Mar 27, 2024
24 changes: 23 additions & 1 deletion scorecards-site/static/viewer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,21 @@
</a>
</div>
</div>
<div class="content"><small class="fw-semibold">API URL:</small>
{{#if data.repo.name}}
{{#if data.repo.commit}}
<a class="btn-link" href="https://api.scorecard.dev/{{data.repo.name}}?commit={{data.repo.commit}}" target="_blank" rel="noopener noreferrer">
https://api.scorecard.dev/{{data.repo.name}}
</a>
{{else}}
<a class="btn-link" href="https://api.scorecard.dev/{{data.repo.name}}" target="_blank" rel="noopener noreferrer">
https://api.scorecard.dev/{{data.repo.name}}
</a>
{{/if}}
{{else}}
<span class="text-muted">-</span>
{{/if}}
</div>
<div class="content text-truncate"><small class="fw-semibold">COMMIT:</small>
{{#if data.repo.commit}}
<span class="d-none d-sm-inline-block text-muted">{{data.repo.commit}}</span>
Expand All @@ -865,6 +880,13 @@
<span class="text-muted">-</span>
{{/if}}
</div>
<div class="content"><small class="fw-semibold">SCORECARD VERSION:</small>
{{#if data.scorecard.version}}
<span class="text-muted">{{data.scorecard.version}}</span>
{{else}}
<span class="text-muted">-</span>
{{/if}}
</div>
</div>
<div class="d-none d-md-inline-block select-wrapper">
<div class="d-flex flex-row align-items-center">
Expand Down Expand Up @@ -1295,7 +1317,7 @@
}

async function apiFetch(platform, org, repo, commit) {
const response = await fetch(`https://api.securityscorecards.dev/projects/${platform}/${org}/${repo}${commit ? `?commit=${commit}` : ''}`);
const response = await fetch(`https://api.scorecard.dev/projects/${platform}/${org}/${repo}${commit ? `?commit=${commit}` : ''}`);
if (response.ok) {
const data = await response.json();
return data;
Expand Down
Loading