badges / badges/shields

GitHub Occurrences Badge

Open
#4,068 9 comments 0 reactions 0 assignees View on GitHub
service-badge
Dominant language
JavaScript
Stars
27.2k
Forks
5.6k
Avg merge
1d 8h
Merged PRs (30d)
46

Description

:clipboard: **Description**

A badge for GitHub that counts the occurrences of a sequence in a file.

For example, given `/github/occurances/badges/shields/README.md/badge`, the badge would show *22* (badge occurs in README.md 22 times).

Optimally, sequence should be a regular expression (escape sequences, word boundaries, character classes).

:link: **Data**

The data required for this can be retrieved from `https://raw.githubusercontent.com/:user/:repo/:branch/:path`. It only requires authentication for private repositories.
Unfortunately I don't know of any official documentation for this endpoint, only that it is the destination when pressing "Raw" on a file on GitHub.

Additional processing is required and would need to be limited.

:microphone: **Motivation**

I personally want to use it to count the number of facts in a text file (each fact is on its own line).
A badge for counting lines would work, but being able to count anything opens the door for a lot more opportunity:
- How many times is "as you know" mentioned in a story?
- How many times, if at all, is `goto` used?
- How many code blocks are present?
- How many references to a shutdown API exist?

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the proposed raw.githubusercontent.com URL and the example GitHub occurrence badge path; the issue does not name repository files or tests. Define the supported sequence or regular-expression input, processing limits, and private-repository behavior, then verify that the resulting badge reports the expected occurrence count.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, javascript
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.