diff --git a/.github/pinact.yaml b/.github/pinact.yaml index 37898a900..ab27e6252 100644 --- a/.github/pinact.yaml +++ b/.github/pinact.yaml @@ -5,6 +5,13 @@ files: - pattern: workflows/*.yaml rules: + # dtolnay publishes toolchain-specific commits without matching Git tags, + # so pinact cannot verify the toolchain version as an action release tag. + # The Vitest invariant still requires a full SHA and explanatory comment. + - ignore: true + conditions: + - expr: ActionName == "dtolnay/rust-toolchain" + # gh-aw owns generated lockfile annotations. Preserve its major-version # comments while the Vitest invariant still enforces a full SHA and comment. - ignore: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 621537e18..061963858 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -605,7 +605,7 @@ jobs: uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@ee868d7805ade43a1b47dd054727ab76c9108b4f # 1.94.1 + uses: dtolnay/rust-toolchain@ee868d7805ade43a1b47dd054727ab76c9108b4f # toolchain: 1.94.1 with: toolchain: 1.94.1 components: rustfmt, clippy @@ -703,7 +703,7 @@ jobs: run: pnpm install --frozen-lockfile --ignore-scripts - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@ee868d7805ade43a1b47dd054727ab76c9108b4f # 1.94.1 + uses: dtolnay/rust-toolchain@ee868d7805ade43a1b47dd054727ab76c9108b4f # toolchain: 1.94.1 with: toolchain: 1.94.1 diff --git a/.github/workflows/contribution-data.yml b/.github/workflows/contribution-data.yml index d0748e6ad..c495f3596 100644 --- a/.github/workflows/contribution-data.yml +++ b/.github/workflows/contribution-data.yml @@ -1,4 +1,4 @@ -# Publishes merged pull request contributors to the orphan `website-data` +# Publishes default-branch commit contributors to the orphan `website-data` # branch. The docs site fetches the deterministic JSONL at runtime. name: Publish website contribution data @@ -9,7 +9,6 @@ on: permissions: contents: write - pull-requests: read concurrency: group: website-contribution-data @@ -28,27 +27,28 @@ jobs: - name: Collect contributors run: | set -euo pipefail - gh api graphql --paginate \ - -F owner="${REPO%/*}" \ - -F name="${REPO#*/}" \ - -f query=' - query($owner: String!, $name: String!, $endCursor: String) { - repository(owner: $owner, name: $name) { - pullRequests(states: MERGED, first: 100, after: $endCursor) { - pageInfo { hasNextPage endCursor } - nodes { author { __typename login } } - } - } - }' \ - --jq '.data.repository.pullRequests.nodes[]' | + gh api --paginate \ + -H 'Accept: application/vnd.github+json' \ + -H 'X-GitHub-Api-Version: 2022-11-28' \ + "repos/${REPO}/contributors?per_page=100&anon=0" \ + --jq '.[]' | jq -cS -s ' map(select( - .author != null - and .author.__typename == "User" - and (.author.login | endswith("[bot]") | not) + .login != null + and .type == "User" + and (.login | endswith("[bot]") | not) + and (.contributions | type == "number" and . > 0 and floor == .) )) - | group_by(.author.login) - | map({login: .[0].author.login, prs: length}) + | group_by(.login | ascii_downcase) + | map( + (map(.contributions) | add) as $commits + | { + commits: $commits, + login: .[0].login, + # Compatibility alias for the currently deployed reader. + prs: $commits + } + ) | sort_by(.login | ascii_downcase) | .[]' > contributors.jsonl diff --git a/scripts/ci-workflow.test.ts b/scripts/ci-workflow.test.ts index 0da2bcedc..2b8fb66ae 100644 --- a/scripts/ci-workflow.test.ts +++ b/scripts/ci-workflow.test.ts @@ -48,6 +48,15 @@ const communityContributionWorkflow = parse(communityContributionWorkflowSource) permissions: Record; jobs: Record; }; +const contributionDataWorkflowSource = readFileSync(".github/workflows/contribution-data.yml", "utf8"); +const contributionDataWorkflow = parse(contributionDataWorkflowSource) as { + on: { + push: { branches: string[] }; + workflow_dispatch: null; + }; + permissions: Record; + jobs: Record; +}; const actionPinningWorkflow = parse(readFileSync(".github/workflows/pin-actions.yml", "utf8")) as { on: { push: { paths: string[] }; @@ -118,7 +127,7 @@ describe("GitHub Action pinning", () => { it.each([ `uses: actions/checkout@${sha} # v4.4.0`, `uses: "actions/checkout@${sha}" # v4.4.0`, - `uses: dtolnay/rust-toolchain@${sha} # 1.94.1`, + `uses: dtolnay/rust-toolchain@${sha} # toolchain: 1.94.1`, "uses: ./path/to/local-action", "uses: docker://alpine:3.22", ])("accepts immutable, local or container reference: %s", (line) => { @@ -330,6 +339,37 @@ describe("Community contribution labeler workflow", () => { }); }); +describe("Website contribution data workflow", () => { + const publish = contributionDataWorkflow.jobs.publish; + const collect = publish.steps.find((candidate) => candidate.name === "Collect contributors")?.run ?? ""; + + it("publishes default-branch commit contributors after changes and on demand", () => { + expect(contributionDataWorkflow.on).toEqual({ + push: { branches: ["main"] }, + workflow_dispatch: null, + }); + expect(contributionDataWorkflow.permissions).toEqual({ contents: "write" }); + expect(publish.if).toBe("github.repository == 'microsoft/scope'"); + }); + + it("collects paginated human default-branch contributors deterministically", () => { + expect(collect).toContain("gh api --paginate"); + expect(collect).toContain('"repos/${REPO}/contributors?per_page=100&anon=0"'); + expect(collect).toContain('.type == "User"'); + expect(collect).toContain('endswith("[bot]")'); + expect(collect).toContain("group_by(.login | ascii_downcase)"); + expect(collect).toContain("commits: $commits"); + expect(collect).toContain("prs: $commits"); + expect(collect).toContain("sort_by(.login | ascii_downcase)"); + }); + + it("keeps every embedded shell step syntactically valid", () => { + for (const command of publish.steps.filter((candidate) => candidate.run)) { + expect(spawnSync("bash", ["-n"], { input: command.run }).status, command.name).toBe(0); + } + }); +}); + describe("Public CLI release workflow", () => { const release = parse(readFileSync(".github/workflows/publish-cli.yml", "utf8")) as { on: Record; diff --git a/website/AGENTS.md b/website/AGENTS.md index 4ed0ee1f6..353883560 100644 --- a/website/AGENTS.md +++ b/website/AGENTS.md @@ -221,25 +221,30 @@ player or its scripts. ### Contributors The landing page (an avatar wall) and the **Community → Contributors** -page (a card grid) thank every author of a merged pull request, -community and Microsoft alike: +page (a card grid) thank everyone with commits attributed on the +repository's default branch (`main`), community and Microsoft alike: - The publisher writes `contributors.jsonl` to `website-data`. It - counts merged PRs whose author is a user, not a bot (`[bot]` suffix). - Team members count too; don't filter on `authorAssociation`. + uses GitHub's repository contributors endpoint and counts commits + attributed on the default branch for user accounts, excluding bots + (`[bot]` suffix) and anonymous entries. - [`.github/workflows/contribution-data.yml`](../.github/workflows/contribution-data.yml) - runs after pushes to `main` (including merged pull requests) and on - demand. It updates the orphan data branch only when the deterministic - file changes. -- One line per person, `{"login":"…","prs":N}`, with sorted keys and - sorted by lowercase login. No avatar URLs or timestamps; avatars come - from `https://github.com/.png`, and a failed image shows the - login's initial. -- The browser sorts by merged PRs, then login. The wall shows up to + runs after pushes to `main` and on demand. It updates the orphan data + branch only when the deterministic file changes. +- One line per person, `{"commits":N,"login":"…","prs":N}`, with sorted + keys and sorted by lowercase login. `prs` is a temporary compatibility + alias for the previously deployed reader and must equal `commits`; the + browser also accepts legacy lines containing only `prs`. No avatar URLs + or timestamps are published; avatars come from + `https://github.com/.png`, and a failed image shows the login's + initial. +- The browser sorts by default-branch commits, then login. The wall shows up to `limit` items; the last slot becomes a "+N" bubble that links to the full grid. The grid shows `limit` cards (30 on the Contributors page) and a "Show all N contributors" button, unless only one card - would stay hidden. Each person links to their merged PRs. + would stay hidden. Each person still links to their merged PRs; copy + must not imply that this destination explains the displayed commit + count. - Wall tooltips get a `--tip-shift` so they stay inside the wall (a hidden tip on an edge avatar would otherwise make narrow pages scroll sideways). The intro and count are hidden in the empty and error diff --git a/website/README.md b/website/README.md index 570e9a19f..8f3e804e7 100644 --- a/website/README.md +++ b/website/README.md @@ -198,10 +198,11 @@ table of contents, code examples, and previous/next navigation. example, and the contributor avatars (pop-in, hover tooltips), with pause controls and reduced-motion support. The logo and documentation chrome remain still. -- **Contribution:** a landing-page wall and full grid thank merged-PR - contributors, refreshed after merges from a data branch without a - redeploy. The publisher is `.github/workflows/contribution-data.yml`; - see "Contributors" in `AGENTS.md`. +- **Contribution:** a landing-page wall and full grid thank contributors with + commits attributed on the default branch (`main`), refreshed after + default-branch changes from a data branch without a redeploy. Contributor + links still open merged pull requests. The publisher is + `.github/workflows/contribution-data.yml`; see "Contributors" in `AGENTS.md`. ### Showreel diff --git a/website/src/components/contribute/ContributeTeaser.astro b/website/src/components/contribute/ContributeTeaser.astro index 5029839ff..237d4d657 100644 --- a/website/src/components/contribute/ContributeTeaser.astro +++ b/website/src/components/contribute/ContributeTeaser.astro @@ -16,11 +16,11 @@ const allHref = `${import.meta.env.BASE_URL.replace(/\/$/, '')}/community/contri

- +

-

Everyone below got a pull request merged into Scope. Hover an avatar to see how many.

+

Everyone below has commits attributed on Scope's main branch. Hover an avatar to see how many; select it to view merged pull requests.

See all contributors diff --git a/website/src/components/contribute/Contributors.astro b/website/src/components/contribute/Contributors.astro index f0337a26b..d909372ee 100644 --- a/website/src/components/contribute/Contributors.astro +++ b/website/src/components/contribute/Contributors.astro @@ -46,7 +46,7 @@ const listId = `thanks-list-${variant}`; ) }

- No pull request contributors are available yet. + No contributors with commits on main are available yet.

We couldn't load the list. See diff --git a/website/src/content/docs/community/contribute.mdx b/website/src/content/docs/community/contribute.mdx index 3e51d5adb..7cac9359f 100644 --- a/website/src/content/docs/community/contribute.mdx +++ b/website/src/content/docs/community/contribute.mdx @@ -1,12 +1,14 @@ --- title: Contributors -description: Thanking everyone whose pull requests have been merged into Scope. +description: Thanking everyone with commits attributed on Scope's main branch. --- import Contributors from '../../../components/contribute/Contributors.astro'; -Thank you to everyone who got a pull request merged, from the community -and the Scope team alike. Select a name to see their merged pull requests. This list also -refreshes automatically after pull requests merge. +Thank you to everyone with commits attributed on Scope's main branch, from the +community and the Scope team alike. Counts come from GitHub's repository +contributor statistics for the default branch. Select a name to see that +person's merged pull requests. The list refreshes automatically after changes +land on main. diff --git a/website/src/data/contributors.sample.jsonl b/website/src/data/contributors.sample.jsonl index d2fee8679..fe9f68df6 100644 --- a/website/src/data/contributors.sample.jsonl +++ b/website/src/data/contributors.sample.jsonl @@ -1,9 +1,9 @@ -{"login":"cedricvidal","prs":11} -{"login":"chanezon","prs":1} -{"login":"cmaneu","prs":2} -{"login":"duffney","prs":3} -{"login":"Gile987","prs":1} -{"login":"idhanth","prs":2} -{"login":"itsmeasadali","prs":1} -{"login":"manekinekko","prs":14} -{"login":"mnkj0021","prs":1} +{"commits":515,"login":"cedricvidal","prs":515} +{"commits":9,"login":"chanezon","prs":9} +{"commits":2,"login":"cmaneu","prs":2} +{"commits":58,"login":"duffney","prs":58} +{"commits":1,"login":"Gile987","prs":1} +{"commits":2,"login":"idhanth","prs":2} +{"commits":1,"login":"itsmeasadali","prs":1} +{"commits":46,"login":"manekinekko","prs":46} +{"commits":2,"login":"mnkj0021","prs":2} diff --git a/website/src/scripts/contributors-element.ts b/website/src/scripts/contributors-element.ts index e39795a62..340ff32a3 100644 --- a/website/src/scripts/contributors-element.ts +++ b/website/src/scripts/contributors-element.ts @@ -4,16 +4,16 @@ import { CONTRIBUTORS_DATA_URL, avatarUrl, + commitsLabel, contributorsLabel, fetchContributors, firstPage, parseContributors, - prsLabel, prsUrl, showAllLabel, sortForDisplay, tipShift, - totalPrs, + totalCommits, visible, type Contributor, type ContributorsResult, @@ -28,7 +28,7 @@ const LIFT_SCALE = 1.14; const MAX_STAGGER_STEPS = 24; /** - * Thanks contributors: authors of merged pull requests, bots aside. Renders + * Thanks default-branch commit contributors, bots aside. Renders * an avatar wall (landing) or a card grid (Contribute page). Without * JavaScript a link to the GitHub contributors graph stays visible. Motion * is skipped entirely when the visitor prefers reduced motion. @@ -119,10 +119,10 @@ class ScopeContributors extends HTMLElement { this.updateShowAll(grid ? hidden : 0); const people = this.contributors.length; - const prs = totalPrs(this.contributors); + const commits = totalCommits(this.contributors); this.querySelectorAll('[data-count-label]').forEach((label) => { label.textContent = contributorsLabel(people); }); - this.querySelectorAll('[data-prs]').forEach((element) => { element.textContent = prsLabel(prs); }); - this.querySelectorAll('[data-count-text]').forEach((text) => { text.textContent = `${people} ${contributorsLabel(people)}, ${prsLabel(prs)}`; }); + this.querySelectorAll('[data-commits]').forEach((element) => { element.textContent = commitsLabel(commits); }); + this.querySelectorAll('[data-count-text]').forEach((text) => { text.textContent = `${people} ${contributorsLabel(people)}, ${commitsLabel(commits)}`; }); this.loaded = true; this.setState(people ? 'ready' : 'empty'); this.reveal(); @@ -259,7 +259,7 @@ class ScopeContributors extends HTMLElement { link.append(this.image(contributor, 56)); const tip = this.span(link, 'thanks-tip'); this.span(tip, 'thanks-tip__login', `@${contributor.login}`); - this.span(tip, 'thanks-tip__prs', prsLabel(contributor.prs)); + this.span(tip, 'thanks-tip__commits', commitsLabel(contributor.commits)); this.span(link, 'sr-only', ' (opens in a new tab)'); return item; } @@ -270,7 +270,7 @@ class ScopeContributors extends HTMLElement { link.append(this.image(contributor, 96)); const body = this.span(link, 'thanks-card__body'); this.span(body, 'thanks-card__login', `@${contributor.login}`).title = `@${contributor.login}`; - this.span(body, 'thanks-card__prs', prsLabel(contributor.prs)); + this.span(body, 'thanks-card__commits', commitsLabel(contributor.commits)); this.span(link, 'contrib-card__arrow thanks-card__arrow', '↗').setAttribute('aria-hidden', 'true'); this.span(link, 'sr-only', ' (opens in a new tab)'); return item; diff --git a/website/src/scripts/contributors.test.mjs b/website/src/scripts/contributors.test.mjs index 5d69ff5ca..73c192a48 100644 --- a/website/src/scripts/contributors.test.mjs +++ b/website/src/scripts/contributors.test.mjs @@ -8,24 +8,24 @@ import assert from 'node:assert/strict'; import { readFileSync } from 'node:fs'; import { avatarUrl, + commitsLabel, contributorsLabel, firstPage, parseContributors, - prsLabel, prsUrl, showAllLabel, sortForDisplay, tipShift, - totalPrs, + totalCommits, visible, } from './contributors.ts'; const line = (value) => JSON.stringify(value); test('parses JSON Lines and ignores blank lines', () => { - const text = [line({ login: 'ada', prs: 2 }), '', line({ login: 'grace-h', prs: 1 }), ''].join('\n'); + const text = [line({ commits: 2, login: 'ada', prs: 2 }), '', line({ commits: 1, login: 'grace-h', prs: 1 }), ''].join('\n'); assert.deepEqual(parseContributors(text), { - contributors: [{ login: 'ada', prs: 2 }, { login: 'grace-h', prs: 1 }], + contributors: [{ login: 'ada', commits: 2 }, { login: 'grace-h', commits: 1 }], skipped: [], }); }); @@ -34,29 +34,37 @@ test('treats an empty file as no contributors', () => { assert.deepEqual(parseContributors(''), { contributors: [], skipped: [] }); }); -test('skips invalid logins, counts and duplicates without dropping the rest', () => { +test('accepts the legacy PR field as a commit count during rollout', () => { + assert.deepEqual(parseContributors(line({ login: 'ada', prs: 2 })), { + contributors: [{ login: 'ada', commits: 2 }], + skipped: [], + }); +}); + +test('skips invalid logins, counts, aliases and duplicates without dropping the rest', () => { const text = [ '{not json', - line({ login: 'dependabot[bot]', prs: 9 }), - line({ login: '-leading', prs: 1 }), - line({ login: 'double--hyphen', prs: 1 }), - line({ login: '../evil', prs: 1 }), - line({ login: 'zero', prs: 0 }), - line({ login: 'fraction', prs: 1.5 }), - line({ login: 'Kept', prs: 3 }), - line({ login: 'kept', prs: 1 }), + line({ commits: 9, login: 'dependabot[bot]', prs: 9 }), + line({ commits: 1, login: '-leading', prs: 1 }), + line({ commits: 1, login: 'double--hyphen', prs: 1 }), + line({ commits: 1, login: '../evil', prs: 1 }), + line({ commits: 0, login: 'zero', prs: 0 }), + line({ commits: 1.5, login: 'fraction', prs: 1.5 }), + line({ commits: 3, login: 'mismatch', prs: 2 }), + line({ commits: 3, login: 'Kept', prs: 3 }), + line({ commits: 1, login: 'kept', prs: 1 }), ].join('\r\n'); const { contributors, skipped } = parseContributors(text); - assert.deepEqual(contributors, [{ login: 'Kept', prs: 3 }]); - assert.deepEqual(skipped, [1, 2, 3, 4, 5, 6, 7, 9]); + assert.deepEqual(contributors, [{ login: 'Kept', commits: 3 }]); + assert.deepEqual(skipped, [1, 2, 3, 4, 5, 6, 7, 8, 10]); }); -test('sorts by merged PRs, then login case-insensitively', () => { +test('sorts by commits, then login case-insensitively', () => { const sorted = sortForDisplay([ - { login: 'zed', prs: 1 }, - { login: 'Bea', prs: 1 }, - { login: 'max', prs: 4 }, - { login: 'alex', prs: 1 }, + { login: 'zed', commits: 1 }, + { login: 'Bea', commits: 1 }, + { login: 'max', commits: 4 }, + { login: 'alex', commits: 1 }, ]); assert.deepEqual(sorted.map((c) => c.login), ['max', 'alex', 'Bea', 'zed']); }); @@ -69,13 +77,13 @@ test('builds avatar and merged PR URLs', () => { assert.equal(url.searchParams.get('q'), 'is:pr is:merged author:grace-h'); }); -test('pluralizes labels and totals PRs', () => { - assert.equal(prsLabel(1), '1 merged PR'); - assert.equal(prsLabel(3), '3 merged PRs'); +test('pluralizes labels and totals commits', () => { + assert.equal(commitsLabel(1), '1 commit on main'); + assert.equal(commitsLabel(3), '3 commits on main'); assert.equal(contributorsLabel(1), 'contributor'); assert.equal(contributorsLabel(2), 'contributors'); - assert.equal(totalPrs([{ login: 'a', prs: 2 }, { login: 'b', prs: 3 }]), 5); - assert.equal(totalPrs([]), 0); + assert.equal(totalCommits([{ login: 'a', commits: 2 }, { login: 'b', commits: 3 }]), 5); + assert.equal(totalCommits([]), 0); }); test('keeps a slot for the overflow bubble', () => { @@ -134,6 +142,8 @@ test('the dev sample file is valid and sorted like the published file', () => { const logins = contributors.map((c) => c.login.toLowerCase()); assert.deepEqual(logins, [...logins].sort()); for (const raw of text.trim().split('\n')) { - assert.deepEqual(Object.keys(JSON.parse(raw)), ['login', 'prs'], 'keys are sorted and nothing else is published'); + const value = JSON.parse(raw); + assert.deepEqual(Object.keys(value), ['commits', 'login', 'prs'], 'keys are sorted and nothing else is published'); + assert.equal(value.prs, value.commits, 'the compatibility alias matches the commit count'); } }); diff --git a/website/src/scripts/contributors.ts b/website/src/scripts/contributors.ts index aae7281c4..f7abb5597 100644 --- a/website/src/scripts/contributors.ts +++ b/website/src/scripts/contributors.ts @@ -11,9 +11,10 @@ export const CONTRIBUTORS_DATA_URL = `https://raw.githubusercontent.com/${REPOSI export const CONTRIBUTORS_GRAPH_URL = `https://github.com/${REPOSITORY}/graphs/contributors`; export interface Contributor { + /** GitHub account login. */ login: string; - /** Number of merged pull requests. */ - prs: number; + /** Number of commits attributed on the repository's default branch. */ + commits: number; } export interface ContributorsResult { @@ -25,10 +26,16 @@ export interface ContributorsResult { // GitHub logins: alphanumerics and single hyphens, up to 39 characters. const LOGIN = /^[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}$/; -function isContributor(value: unknown): value is Contributor { - if (typeof value !== 'object' || value === null) return false; - const { login, prs } = value as Record; - return typeof login === 'string' && LOGIN.test(login) && Number.isSafeInteger(prs) && (prs as number) > 0; +/** Normalizes current and legacy published records into the browser model. */ +function parseContributor(value: unknown): Contributor | undefined { + if (typeof value !== 'object' || value === null) return undefined; + const record = value as Record; + const { login } = record; + const commits = Object.hasOwn(record, 'commits') ? record.commits : record.prs; + if (typeof login !== 'string' || !LOGIN.test(login)) return undefined; + if (typeof commits !== 'number' || !Number.isSafeInteger(commits) || commits <= 0) return undefined; + if (Object.hasOwn(record, 'commits') && Object.hasOwn(record, 'prs') && record.prs !== commits) return undefined; + return { login, commits }; } /** @@ -48,19 +55,20 @@ export function parseContributors(text: string): ContributorsResult { skipped.push(index + 1); return; } - if (!isContributor(value) || seen.has(value.login.toLowerCase())) { + const contributor = parseContributor(value); + if (!contributor || seen.has(contributor.login.toLowerCase())) { skipped.push(index + 1); return; } - seen.add(value.login.toLowerCase()); - contributors.push({ login: value.login, prs: value.prs }); + seen.add(contributor.login.toLowerCase()); + contributors.push(contributor); }); return { contributors, skipped }; } -/** Display order: most merged PRs first, then by login. */ +/** Display order: most commits first, then by login. */ export function sortForDisplay(contributors: readonly Contributor[]): Contributor[] { - return [...contributors].sort((a, b) => b.prs - a.prs || a.login.localeCompare(b.login, 'en', { sensitivity: 'base' })); + return [...contributors].sort((a, b) => b.commits - a.commits || a.login.localeCompare(b.login, 'en', { sensitivity: 'base' })); } export function avatarUrl(login: string, size = 96): string { @@ -73,16 +81,16 @@ export function prsUrl(login: string): string { return `https://github.com/${REPOSITORY}/pulls?q=${encodeURIComponent(query)}`; } -export function prsLabel(count: number): string { - return count === 1 ? '1 merged PR' : `${count} merged PRs`; +export function commitsLabel(count: number): string { + return count === 1 ? '1 commit on main' : `${count} commits on main`; } export function contributorsLabel(count: number): string { return count === 1 ? 'contributor' : 'contributors'; } -export function totalPrs(contributors: readonly Contributor[]): number { - return contributors.reduce((sum, contributor) => sum + contributor.prs, 0); +export function totalCommits(contributors: readonly Contributor[]): number { + return contributors.reduce((sum, contributor) => sum + contributor.commits, 0); } /** Splits the list into what fits under `limit` and how many are left over. */ diff --git a/website/src/styles/contributors.css b/website/src/styles/contributors.css index 03ef9015a..1f6639fd9 100644 --- a/website/src/styles/contributors.css +++ b/website/src/styles/contributors.css @@ -88,7 +88,7 @@ } .thanks-tip::after { content: ''; position: absolute; top: 100%; left: calc(50% - var(--tip-shift, 0px)); border: 5px solid transparent; border-top-color: var(--scope-text); transform: translateX(-50%); } .thanks-tip__login { font-weight: 650; } -.thanks-tip__prs { opacity: 0.75; } +.thanks-tip__commits { opacity: 0.75; } .thanks-avatar:is(:hover, :focus-visible) .thanks-tip { opacity: 1; transform: translate(calc(-50% + var(--tip-shift, 0px)), 0) scale(1); } /* Skeletons. */ @@ -106,7 +106,7 @@ .thanks-card:is(:hover, :focus-visible) .thanks-photo { box-shadow: 0 0 0 2px var(--scope-surface), 0 0 0 4px var(--scope-brand); } .thanks-card__body { display: flex; flex-direction: column; min-width: 0; } .thanks-card__login { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; } -.thanks-card__prs { color: var(--scope-muted); font-size: 0.78rem; } +.thanks-card__commits { color: var(--scope-muted); font-size: 0.78rem; } .thanks-card__arrow { margin-left: auto; color: var(--scope-brand); } .thanks-show-all { display: flex; align-items: center; gap: 0.5rem; margin: 1.5rem auto 0 !important; padding: 0.6rem 1.25rem; border: 1px solid var(--scope-border); border-radius: 999px; background: var(--scope-surface); color: var(--scope-brand); font: 600 0.9rem var(--sl-font); cursor: pointer; transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); } .thanks-show-all:is(:hover, :focus-visible) { border-color: var(--scope-brand); box-shadow: var(--scope-shadow); transform: translateY(-2px); }