Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/pinact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
40 changes: 20 additions & 20 deletions .github/workflows/contribution-data.yml
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -9,7 +9,6 @@ on:

permissions:
contents: write
pull-requests: read

concurrency:
group: website-contribution-data
Expand All @@ -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

Expand Down
42 changes: 41 additions & 1 deletion scripts/ci-workflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ const communityContributionWorkflow = parse(communityContributionWorkflowSource)
permissions: Record<string, string>;
jobs: Record<string, Job>;
};
const contributionDataWorkflowSource = readFileSync(".github/workflows/contribution-data.yml", "utf8");
const contributionDataWorkflow = parse(contributionDataWorkflowSource) as {
on: {
push: { branches: string[] };
workflow_dispatch: null;
};
permissions: Record<string, string>;
jobs: Record<string, Job>;
};
const actionPinningWorkflow = parse(readFileSync(".github/workflows/pin-actions.yml", "utf8")) as {
on: {
push: { paths: string[] };
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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<string, unknown>;
Expand Down
31 changes: 18 additions & 13 deletions website/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/<login>.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/<login>.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
Expand Down
9 changes: 5 additions & 4 deletions website/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions website/src/components/contribute/ContributeTeaser.astro
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ const allHref = `${import.meta.env.BASE_URL.replace(/\/$/, '')}/community/contri
</div>
<p class="contrib-count" data-count-pill>
<span class="contrib-count__pulse" aria-hidden="true"></span>
<span aria-hidden="true"><span class="contrib-count__value" data-count>0</span> <span data-count-label>contributors</span> · <span data-prs>0 merged PRs</span></span>
<span aria-hidden="true"><span class="contrib-count__value" data-count>0</span> <span data-count-label>contributors</span> · <span data-commits>0 commits on main</span></span>
<span class="sr-only" data-count-text></span>
</p>
</div>
<p class="thanks-intro" data-reveal>Everyone below got a pull request merged into Scope. Hover an avatar to see how many.</p>
<p class="thanks-intro" data-reveal>Everyone below has commits attributed on Scope's main branch. Hover an avatar to see how many; select it to view merged pull requests.</p>
</Contributors>
<a class="scope-text-link scope-contrib__all" href={allHref}>See all contributors <span aria-hidden="true">&rarr;</span></a>
</section>
2 changes: 1 addition & 1 deletion website/src/components/contribute/Contributors.astro
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const listId = `thanks-list-${variant}`;
)
}
<p class="contrib-message thanks-message--empty">
No pull request contributors are available yet.
No contributors with commits on main are available yet.
</p>
<p class="contrib-message thanks-message--error">
We couldn't load the list. See
Expand Down
10 changes: 6 additions & 4 deletions website/src/content/docs/community/contribute.mdx
Original file line number Diff line number Diff line change
@@ -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.

<Contributors variant="grid" limit={30} />
18 changes: 9 additions & 9 deletions website/src/data/contributors.sample.jsonl
Original file line number Diff line number Diff line change
@@ -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}
16 changes: 8 additions & 8 deletions website/src/scripts/contributors-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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.
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down
Loading
Loading