Skip to content

Github user's stars (pagination)

When there are many results, GitHub paginates the data. You can use the per_page parameter to loop over the data. Here’s a practical example: getting the total stars across a user’s repositories.

Here’s a Val that returns the star count for a username.

Call it to get the result:

import { getGithubStars } from "https://esm.town/v/vtdocs/getGithubStars";
export const steveGithubStars = getGithubStars("stevekrouse");

Email yourself when you get a comment reaction!

Create a GitHub personal access token: https://github.com/settings/personal-access-tokens/new. Give it permissions to the repositories that you’re interested in getting comment reaction notifications for.

Screenshot 2023-06-13 at 14.36.38.png

Allow Read-only access for issues to find your recent issue comments (pull requests are issues).

Untitled

Go to: https://www.val.town/settings/environment-variables and save the token as githubPatToken.

Fork this Val, change username to your GitHub username, and schedule it to run every fifteen minutes.

When this Val runs, it gets the last 100 events for an authenticated user. It makes additional requests to get the reactions for any recent events that are comments.

If the reaction was created in the last fifteen minutes, then it’s a new comment!

You’ll receive a batch of reactions and comment links only for new reactions.