Repository navigation
[Docs] Automate contributor recognition - #2395
Michael Flanakin (flanakin) wants to merge 11 commits into
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Adds Christopherloof, haflidif, josesarsa, sharmilamusunuru, and xan-archera, and adds bug for JacobStruiksma. Documents the contrib command in the release instructions. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Adds bpurchell and danfiedler-msft for code, documents every contribution type in CONTRIBUTING.md, and updates the release guidance to credit everyone named in the release notes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Add Update-Contributors.ps1, which finds merged PR authors, PR reviewers, and reporters of fixed or accepted bugs and feature requests who are missing from .all-contributorsrc, and adds them with all-contributors-cli while keeping the diff small. Add a weekly update-contributors workflow that opens a PR with the result, unit tests, and docs. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
| schedule: | ||
| - cron: '0 7 * * 1' # Every Monday at 07:00 UTC |
There was a problem hiding this comment.
Better would be per PR, so on PR open or update, if we want to account for reviewers (which is rare)
There was a problem hiding this comment.
🤖 [AI][Claude] ✅ Implemented
Added a per-PR job: on open/update of a same-repo PR it credits the author and reviewers with a commit on the PR branch (like the ms.date workflow). Kept the weekly run as a catch-all, because fork PRs (most external contributors) can't be pushed to, and it covers bugs and feature requests. Note: two open PRs crediting different people can conflict in .all-contributorsrc.
There was a problem hiding this comment.
🤖 [AI][Claude] ❓ Question
Related to Roland's thread above (conflicts and extra commits from per-PR commits). Which do you want: per-PR commits or a weekly/on-push-to-dev job only? Recommendation: on-push-to-dev plus the weekly schedule, no per-PR job.
|
|
||
| # The default window is long on purpose: the script only adds what is missing, so re-checking recent work is | ||
| # harmless, and an unmerged PR from a previous week keeps its entries when the branch is rebuilt from dev. | ||
| - name: Add missing contributors |
There was a problem hiding this comment.
Should we just use npm run contrib directly? PR author can be for code, issue author for bug (?) (or feature depending on context?), issue commenters for ???
There was a problem hiding this comment.
🤖 [AI][Claude] 🤔 Needs discussion
The script already wraps npm run contrib (-Apply runs the CLI per login and keeps the diff small), so I kept it for detection and dedupe. Mapping: PR author = code/doc, issue author = bug/ideas, PR reviewers = review. I did not credit commenters: comments don't prove a contribution, and question is added by hand (@allcontributors please add @user for question). Want a threshold (e.g. 3+ answered issues) instead?
There was a problem hiding this comment.
🤖 [AI][Claude] ❓ Question
Your call on whether the script should stay or the workflow should call npm run contrib directly. Recommendation: keep the script. The CLI alone can't find who is missing or which type applies (PR author = code/doc, issue author = bug/ideas, reviewer = review), and it can't dedupe against the existing list. The script already runs npm run contrib's CLI per login for the actual write. Commenters stay manual.
- Add -PullRequest to Update-Contributors.ps1 to credit one PR's author and reviewers. - Run it on same-repo pull requests and push the credits to the PR branch. - Keep the weekly run for fork PRs, bugs, and feature requests. Co-Authored-By: flanakin <flanakin@users.noreply.github.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
🤖 [AI][Claude] PR Update Summary Addressed: 2 thread(s)
Pester: 77 passed. |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Roland Krummenacher (RolandKrummenacher)
left a comment
There was a problem hiding this comment.
The design and security posture are sound: no pull_request_target, a fork guard, and no ${{ }} inside run:. The tests pass (77 of 77 locally, and Pester on Linux).
The branch is one commit behind #2391, so it needs a rebase; that also brings in the README anchor fix.
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| # Same-repo pull requests only (forks have a read-only token). Skip the weekly PR, which is already the credit. | ||
| if: >- |
There was a problem hiding this comment.
Per-PR commits to .all-contributorsrc and the README tables conflict between parallel PRs and with the weekly PR. Should the weekly job also run on push to dev, with no per-PR job?
There was a problem hiding this comment.
🤖 [AI][Claude] ❓ Question
Escalating to Michael Flanakin (@flanakin): this is a design decision, so I'm not changing it yet. Per-PR commits to .all-contributorsrc and the README tables will conflict between parallel PRs and with the weekly PR, and add an extra head commit per PR that needs checks and approval. Recommendation: drop the per-PR credit-pr job and run the existing weekly job on push to dev (plus the schedule and manual runs). That serves fork PRs too, avoids conflicts, and removes the bot commit on PRs. Trade-off: credits show up in a follow-up PR after merge rather than in the PR itself.
|
@Michael Flanakin (@flanakin): you have some new feedback! Please review and resolve all comments and I'll let reviewers know by removing the |
Co-Authored-By: RolandKrummenacher <RolandKrummenacher@users.noreply.github.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Skip files the contributor CLI rewrites when crediting doc, retry the push after rebasing, set permissions per job, restore PRIVATE_TOKEN, build the summary after -Apply, check multi-line run blocks in the test, set up Node 22.22, and fix the multi-type syntax in CONTRIBUTING.md. Co-Authored-By: RolandKrummenacher <RolandKrummenacher@users.noreply.github.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: RolandKrummenacher <RolandKrummenacher@users.noreply.github.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Summary
Contributors were missed in v15 because crediting them was a manual, per-person step in the release checklist. This adds a script that finds who is missing and a weekly workflow that opens a PR to add them, so nobody is missed.
src/scripts/Update-Contributors.ps1(PowerShell 7, Windows and Linux)Uses the
ghCLI to collect contributions for-Since <date>and/or-Milestone <name>and compares them with.all-contributorsrc(logins compared case-insensitively):codedocdocs/,docs-mslearn/,docs-wiki/, or any*.mdreviewbugType: Bugissue that was fixed or acceptedideasType: Featureissue that was implemented or accepted[bot],app/..., dependabot, copilot, github-actions, allcontributors, OssSecurityBot). Nobody else is skipped, so maintainers who are missing a type are credited too.-Applyruns the repo'sall-contributors-clionce per login (npm ci --ignore-scriptsfirst).-WhatIfis honored with-Apply..all-contributorsrcthrough prettier, which collapses"contributions": [...]onto one line and turns a ~20 line change into a ~500 line diff. After the CLI runs, the script expands the arrays again (keeping CRLF/LF and the trailing blank line), then verifies the result: same contributors in the same order, no credits removed, other settings unchanged, and a text diff with only additions. If that fails, it restores the original files and errors.gh, missingghauth, rate limits (with the reset time, and a pre-check before the per-PR calls), and transient 5xx (retried).question,design,security,mentoring,promotion,leader) are left to humans.Judgment calls worth a look:
doc. Nearly every code PR editsdocs-mslearn/toolkit/changelog.md, which would creditdocto everyone..all-contributorsrcitself is ignored too.bugorideas. CONTRIBUTING.md says "confirmed or fixed", so the issue must be closed as completed or assigned to a milestone, and not closed as not planned or duplicate, or labeledResolution: Duplicate,Won't fix,Can't repro,No activity,External, orSupport request. Without this, a plain-Sincerun credits reporters of duplicates and abandoned issues.Type:label are listed for a human, not credited (for example, the v15 milestone issues from haflidif, josesarsa, and sharmilamusunuru have no type label). They appear in the console, in-SummaryPath, and in the PR body..github/workflows/update-contributors.ymlworkflow_dispatchwith asinceinput. Default window is 60 days, which is safe because the script only adds what is missing, and it lets an unmerged PR keep its entries when the branch is rebuilt.microsoft/finops-toolkitand only fromdev. Permissions arecontents: writeandpull-requests: write. Uses only theactions/checkoutSHA already pinned elsewhere; everything else isgh,npm ci --ignore-scripts, and shell/pwsh..all-contributorsrc,README.md, ordocs/README.mdchanged) force-pushesautomation/update-contributorsfromdev, and opens or updates a PR todevwithgh pr create/gh pr editusingGITHUB_TOKEN. The PR body is the table of what was added.Docs
CONTRIBUTING.md("Recognizing contributors"),.claude/commands/release.md(Contributors bullet), andsrc/scripts/README.mdpoint to the script. No changelog entry: this is repo tooling, not a product change.Maintainer settings needed
GITHUB_TOKENdo not trigger other workflows (the dev.yml checks). Close and reopen the PR to run them, or merge as an admin if the changes are only the contributor files.devrequires status checks onautomation/*PRs, the PR will wait on them.Test plan
Run locally on Windows with PowerShell 7.6 and gh 2.103 (authenticated):
-Milestone v15against the real config: the only gap isflanakinforbug(issues ADX dashboard: List cost / Commitment savings don't match between Summary and Rate Optimization pages #2315 and Hub redeploys can reset msexports and raw retention #2348, bothType: Bug); nothing is missing for bpurchell, danfiedler-msft, JacobStruiksma, Christopherloof, haflidif, josesarsa, sharmilamusunuru, or xan-archera.-Since 2026-04-29: same, nothing missing for those people. It also finds other people missingbug/ideasfor fixed or milestoned issues since then (for example digitalsb, Elgeario, eltanko, jlwebb-fc, rahalan, santiagoamado0209, shweta25586-ms, t2kx, Vikesh1981; plus arthursilvany, DirkBrinkmann, MSBrett, and bpurchell on existing entries). The first workflow run will propose these, so review that PR.bugfrom the copy, ran-Milestone v15 -Apply. It re-added them plus flanakin'sbug, with 21 lines added and 1 removed in.all-contributorsrc(the comma on"promotion"), and a README change of one cell. A second run changed nothing (file hashes identical).-Apply -WhatIfchanged nothing. CRLF and the trailing blank line were preserved.Update-Contributors.Tests.ps1(64 tests: type inference, bot filtering, array re-expansion including a round trip of the committed.all-contributorsrc, dedupe, issue rules, config verification) andAction.UpdateContributors.Tests.ps1(11 tests: permissions, fork/branch guard, SHA pins, input handling). All pass.Test-PowerShell.ps1 -Lint(3970 passed) and-Actionspass.bash -n, and the pwsh step parses. Re-read by hand. actionlint is not installed.workflow_dispatch,GITHUB_TOKENaccess to PR/issue reads with onlycontents/pull-requestsscopes, the force-push,gh pr create, and the fallback link are untested. The first run should be a manualworkflow_dispatchfromdev.🤖 Generated with Claude Code