A small Deno utility that fetches a GitHub user's starred repositories and produces two outputs:
deno-starshower_output/Starred_Repos.json— the raw JSON array returned by GitHubdeno-starshower_output/Starred_Repos.md— a readable Markdown report grouped by the year each repository was last pushed to
The project uses @octokit/rest to fetch data and zod to validate the
responses. Import mappings are defined in deno.json.
👉️ See the Sample Output here. 👈️
👉️ And the JSON here. 👈️
I run this repo in a GitHub action to auto-update my
bridgetown based personal website, hosted on
GitHub.
Visit my
GitHub Action yaml
for some inspiration.
- Deno (recent stable release with npm compatibility)
- A GitHub token to increase API rate limits. Set
GITHUB_STARSHOWER,GITHUB_TOKENorGH_PATin the environment. The token needs onlypublic_reposcope.
GITHUB_STARSHOWERis the preferred way.
No clue what that token is, or how to set it up?
Read GitHub Docs,
or use your preferred search engine, to learn how to create yours.
- Install Deno: follow instructions at https://deno.com.
- Export a GitHub token:
export GITHUB_STARSHOWER=your_token_hereRun the script with a GitHub username (omit the @ sign). The script requires
permissions to access the network, read environment variables, and write files.
deno run --allow-env --allow-net --allow-write main.ts --helpdeno run --allow-env --allow-net --allow-write main.ts <github_username>OR download the single file binary release from the releases page and run:
chmod +x deno-starshower_<version>
./deno-starshower_<version> <github_username>deno-starshower_output/Starred_Repos.json— the validated JSON array of starred repositoriesdeno-starshower_output/Starred_Repos.md— a Markdown report generated from the JSON and grouped by thepushed_atyear
Both files are written to the deno-starshower_output directory. The script
will create the directory if it does not exist.
lib/client.tscreates an Octokit client (usingGITHUB_STARSHOWER,GITHUB_TOKENorGH_PATif provided) and usesoctokit.paginateto fetch all starred repositories for a user. The response is validated with the Zod schema intypes.ts.lib/repo-to-markdown.tstransforms validated repository objects into Markdown sections grouped by year.main.tsorchestrates the process: it fetches data, writes the JSON file, groups repositories by year, and writes the Markdown report.
- Run the unit tests:
deno testmain.ts— program entry and orchestrationlib/client.ts— GitHub API client and paginationlib/repo-to-markdown.ts— Markdown rendering helperstypes.ts— Zod schemas and TypeScript interfacesdeno.json— task and import mappings
- Environment token: set
GITHUB_STARSHOWER,GITHUB_TOKENorGH_PATto increase rate limits and avoid authentication errors. - Deno npm compatibility: this project references npm packages via Deno's import
maps in
deno.json. Ensure your Deno version supports the used interoperability. - File permissions: the script writes to
deno-starshower_output/; ensure the process has permission to create and write files in the repository directory.
- add throttling via octokit/plugin-throttling.js
Fetch starred repositories for user octocat:
deno run --allow-env --allow-net --allow-write main.ts octocatAfter the run the two output files will be available under
deno-starshower_output/.
