Repository navigation
Conversation
Microsoft publishes no public download count, so the daily Sort download badges workflow gains a first job that reads StepForge's total Store acquisitions from Partner Center's analytics API, with the Entra app the release already uses (scripts/microsoft-store-downloads.js), and writes a shields.io endpoint file to a badges branch. The branch is always one parentless commit, rebuilt and force-pushed only when the count changes, so it never grows and comes back on the next run if it is deleted. The sort job reads the count from that branch through the contents API and still runs, with the last published count, when Partner Center can't be read.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a Microsoft Store downloads badge to the README, next to the GitHub, APT, Chocolatey and DNF badges. It's sorted with them by count.
How the count gets there
Microsoft publishes no public download count, so the README can't fetch one live the way the other badges do.
Sort download badgesgets a first job,microsoft-store. It signs in with the Entra app the release already uses (MICROSOFT_STORE_TENANT_ID,MICROSOFT_STORE_CLIENT_ID,MICROSOFT_STORE_CLIENT_SECRET). It then reads StepForge's acquisitions from Partner Center's app acquisitions API: monthly rows from 2026-01-01 to today, all pages, summed. This isscripts/microsoft-store-downloads.js.badgesbranch. The README badge isimg.shields.io/endpoint?url=…/badges/microsoft-store-downloads.json.sortjob reads that count through the GitHub contents API, which isn't cached the way raw.githubusercontent.com is, and sorts all five badges.The
badgesbranch recreates itselfbadges. The branch never grows history.I tested the publish step against a local bare remote: first run creates the branch, an unchanged count is skipped, a new count stays one commit, and a deleted branch is recreated.
When Partner Center can't be read
The
microsoft-storejob fails, so the run shows red. Thesortjob still runs (if: !cancelled()), using the last count on the branch. If there's no branch and no count, the sort aborts rather than guessing zero, consistent with how unreadable ProGet feeds are handled.Caveats
Testing
npm test: 1130 pass, 0 fail. Newtests/unit/microsoft-store-downloads.test.jscovers the token request, the acquisition query and paging, the error messages (which never include the secret), the badge JSON, the README badge URL and the workflow wiring.download-badges.test.jscovers the new count source.actionlint(with shellcheck) is clean.