Skip to content

Commit

Permalink
open source dashboard: rename default branch option and set hermit's …
Browse files Browse the repository at this point in the history
…default branch
  • Loading branch information
finn-block committed Jan 24, 2025
1 parent 7501bd0 commit 4600545
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion projects-dashboard/src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineCollection, z } from "astro:content";
const repoSchema = z.object({
owner: z.string(),
name: z.string(),
mainBranch: z.string().optional(),
defaultBranch: z.string().optional(),
subPath: z.string().optional(),
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
repo:
owner: "cashapp"
name: "AccessibilitySnapshot"
mainBranch: "master"
defaultBranch: "master"
title: "AccessibilitySnapshot"
description: "Easy regression testing for iOS accessibility"
branding: "cashapp"
Expand Down
1 change: 1 addition & 0 deletions projects-dashboard/src/content/project/cashapp_hermit.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
repo:
owner: cashapp
name: hermit
defaultBranch: "master"
title: hermit
description: Hermit manages isolated, self-bootstrapping sets of tools in software projects.
branding: cashapp
Expand Down
2 changes: 1 addition & 1 deletion projects-dashboard/src/content/project/square_okhttp.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
repo:
owner: "square"
name: "okhttp"
mainBranch: "master"
defaultBranch: "master"
title: "OkHttp"
description: "Square’s meticulous HTTP client for the JVM, Android, and GraalVM."
branding: "square"
Expand Down
2 changes: 1 addition & 1 deletion projects-dashboard/src/content/project/square_okio.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
repo:
owner: "square"
name: "okio"
mainBranch: "master"
defaultBranch: "master"
title: "okio"
description: "A modern I/O library for Android, Java, and Kotlin Multiplatform."
branding: "square"
Expand Down
12 changes: 6 additions & 6 deletions projects-dashboard/src/lib/badge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ function getGithubActionsBadge(
value = "ci.yml",
label = "ci"
): [string, string] {
const branch = repo.mainBranch ?? "main";
const branch = repo.defaultBranch ?? "main";
const badgeSrc = `https://img.shields.io/github/actions/workflow/status/${repo.owner}/${repo.name}/${value}?style=flat-square&branch=${branch}&logo=github&label=${label}&logoColor=FFFFFF`;
const href = `https://github.com/${repo.owner}/${repo.name}/actions/workflows/${value}`;
return [badgeSrc, href];
}

function getGithubLicenseBadge(repo: Repo): [string, string] {
const branch = repo.mainBranch ?? "main";
const branch = repo.defaultBranch ?? "main";
const badgeSrc = `https://img.shields.io/github/license/${repo.owner}/${repo.name}?style=flat-square&color=4c1&label=license`;
const href = `https://github.com/${repo.owner}/${repo.name}/blob/${branch}/LICENSE`;
return [badgeSrc, href];
Expand Down Expand Up @@ -60,7 +60,7 @@ function getOssfBadge(repo: Repo): [string, string] {
}

function getCodecovBadge(repo: Repo, token?: string): [string, string] {
const branch = repo.mainBranch ?? "main";
const branch = repo.defaultBranch ?? "main";
const badgeSrc = `https://img.shields.io/codecov/c/gh/${repo.owner}/${repo.name}/${branch}?label=codecov&style=flat-square&token=${token}`;
const href = `https://codecov.io/github/${repo.owner}/${repo.name}`;
return [badgeSrc, href];
Expand Down Expand Up @@ -119,7 +119,7 @@ function getReferenceDocsBadge(value?: string): [string, string] {
}

function getCodeOfConductBadge(repo: Repo, value?: string): [string, string] {
const branch = repo.mainBranch ?? "main";
const branch = repo.defaultBranch ?? "main";
const badgeSrc = `https://img.shields.io/badge/Code of Conduct-blue?style=flat-square`;
const href = `https://github.com/${repo.owner}/${repo.name}/blob/${branch}/${value}`;
return [badgeSrc, href];
Expand All @@ -129,7 +129,7 @@ function getContributionGuidelinesBadge(
repo: Repo,
value?: string
): [string, string] {
const branch = repo.mainBranch ?? "main";
const branch = repo.defaultBranch ?? "main";
const badgeSrc = `https://img.shields.io/badge/Contribution Guidelines-orange?style=flat-square`;
const href = `https://github.com/${repo.owner}/${repo.name}/blob/${branch}/${value}`;
return [badgeSrc, href];
Expand Down Expand Up @@ -189,7 +189,7 @@ function getGithubRepoBadge(repo: Repo): [string, string] {
const badgeColor = "gray";
const badgeSrc = `https://img.shields.io/badge/-${badgeValue}-${badgeColor}?style=flat-square&logo=github`;

const branch = repo.mainBranch ?? "main";
const branch = repo.defaultBranch ?? "main";
const subPathUrlSuffix = repo.subPath ? `/tree/${branch}/${repo.subPath}` : "";
const href = `https://github.com/${repo.owner}/${repo.name}${subPathUrlSuffix}`;

Expand Down

0 comments on commit 4600545

Please sign in to comment.