{"id":35252911,"url":"https://github.com/cdklabs/github-merit-badger","last_synced_at":"2026-04-06T07:02:17.475Z","repository":{"id":224978399,"uuid":"764304689","full_name":"cdklabs/github-merit-badger","owner":"cdklabs","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-29T00:10:17.000Z","size":4673,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":11,"default_branch":"main","last_synced_at":"2026-03-29T02:58:41.883Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cdklabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-27T20:54:19.000Z","updated_at":"2026-03-29T00:10:19.000Z","dependencies_parsed_at":"2024-05-21T01:27:37.899Z","dependency_job_id":"ecba34f1-f46e-45ec-952d-3658d9128a14","html_url":"https://github.com/cdklabs/github-merit-badger","commit_stats":null,"previous_names":["cdklabs/github-merit-badger"],"tags_count":0,"template":false,"template_full_name":"amazon-archives/__template_Apache-2.0","purl":"pkg:github/cdklabs/github-merit-badger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdklabs%2Fgithub-merit-badger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdklabs%2Fgithub-merit-badger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdklabs%2Fgithub-merit-badger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdklabs%2Fgithub-merit-badger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdklabs","download_url":"https://codeload.github.com/cdklabs/github-merit-badger/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdklabs%2Fgithub-merit-badger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31463015,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"online","status_checked_at":"2026-04-06T02:00:07.287Z","response_time":112,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-30T07:03:31.373Z","updated_at":"2026-04-06T07:02:17.470Z","avatar_url":"https://github.com/cdklabs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \u003cspan style=\"font-size:8em;\"\u003e🦡\u003c/span\u003e\n\n# GitHub Merit Badger\n\nWelcome to the GitHub Merit Badger! This is a GitHub Action that can add well-known\nmerit badges to pull requests that come in to your repository. It will gamify\ncontributions and galvanize the open-source community to contribute more and more\nto your project!\n\n## Getting Started\n\nThis Action is meant to be run on pull requests only. The below example calls this\nGitHub Action with the following rules:\n\n- Contributors with no merged PRs in the repository are labeled `first-time-contributor`.\n- Contributors with 1 - 4 merged PRs are labeled `repeat-contributor`.\n- Contributors with 5+ merged PRs are labeled `allstar-contributor`.\n\n```yaml\nname: add-merit-badger\non:\n  pull_request_target:\n    types:\n      - opened\n\njobs:\n  merit-badges:\n    runs-on: ubuntu-latest\n    permissions:\n      pull-requests: write\n    steps:\n      - uses: cdklabs/github-merit-badger@main\n        id: github-merit-badger\n        with:\n          github-token: ${{ secrets.GITHUB_TOKEN }}\n          badges: '[first-time-contributor,repeat-contributor,allstar-contributor]'\n          thresholds: '[0,1,5]'\n```\n\nWhen pull requests are opened in a repository with this action, the `github-merit-badger`\naction will run and a label with the correct badge name will be added to the pull request.\n\n## Different Kinds of Badgers\n\nThe way this action works is that it exposes different classes of Badgers via the `badge-type`\nproperty. Right now, there are 2 classes of Badgers available: `AchievementBadger` and `LeaderboardBadger`.\n\n### Achievement Badger\n\n`AchievementBadger` is the default, so examples without a `badge-type` property will utilize the\n`AchievementBadger`. This Badger calculates a rating based on how many pull requests a user\nhas successfully merged to the repository. This rating is then compared to the values inside `threshold`,\nresulting in the corresponding badge being labeled on the incoming pull request.\n\n### Leaderboard Badger\n\n`LeaderboardBadger` can be used by setting `badge-type: 'leaderboard'` in the GitHub Workflow. This Badger\nwill calculate a value based on how a user compares to other contributors in the repository. For example,\nif a user has successfully merged 5 pull requests prior to opening the newest one, `LeaderboardBadger` will\nsee how that ranks against other contributors and return a value based on that. If 5 pull requests is good\nfor 8th place, then the value of 8 is returned and compared to the values inside `threshold`.\n\nConsider the following example usage:\n\n```yaml\nsteps:\n  - uses: cdklabs/github-merit-badger@main\n    id: github-merit-badger\n    with:\n      github-token: ${{ secrets.GITHUB_TOKEN }}\n      badges: '[1st! :trophy:,top 3 :fire:,top 5 :sunglasses:]'\n      thresholds: '[1,3,5]'\n      badge-type: 'leaderboard'\n```\n\nWhen kaizencc@ submits a PR, the Action will find that he has submitted 25 lifetime PRs to the repository, which is good for 2nd place. kaizencc@ will thus receive the `top 3 :fire:` badge on their PR.\n\n## Badge Descriptions\n\nIn addition to adding labels on pull requests, this GitHub Action can also write custom\ncomments on each PR explaining what the badges mean. To include this functionality,\nadd the `badge-descriptions` paramater to the action, where each description matches 1\nto 1 with the `badges` parameter:\n\n```yaml\nsteps:\n  - uses: cdklabs/github-merit-badger@main\n    id: github-merit-badger\n    with:\n      github-token: ${{ secrets.GITHUB_TOKEN }}\n      badges: '[first-time-contributor,repeat-contributor,allstar-contributor]'\n      thresholds: '[0,1,5]'\n      badge-descriptions: '[this is your first contribution!,you've been here before, welcome back!,you've made so many contributions that we think you rock!]'\n```\n\nIf a user, kaizencc, opens a PR to a repository they frequent, this will produce a\ncomment saying:\n\n```\nWelcome kaizencc@! You are an allstar contributor, which means that you've made so many contributions that we think you rock! Keep up the good work!\n```\n\n## Additional Filters\n\nIn the basic use case, the Action scoures the full history of pull requests in your \nrepository and filters for a specific username. You can specify additional filters on\nthe basic use case to customize for the specific use case you want.\n\n### Days\n\nSpecify a number of days you want the Action to look at. For example, if you specify\n30 days, then the Action will only look at the pull request history from the past 30 days.\n\n```yaml\nsteps:\n  - uses: cdklabs/github-merit-badger@main\n    id: github-merit-badger\n    with:\n      github-token: ${{ secrets.GITHUB_TOKEN }}\n      badges: '[first-time-contributor,repeat-contributor,allstar-contributor]'\n      thresholds: '[0,1,5]'\n      days: 365\n```\n\nIn the above example, your badge is only valid on contributions from the past year, which\nis similar to airline frequent flyer programs. If you don't continue to contribute, your\nbadge may be removed!\n\n### Ignore Usernames\n\nSpecify a list of usernames that the Action should ignore. This is useful if you want to\ncreate badges for the community, but you don't want to add labels to the core maintainers.\n\n```yaml\nsteps:\n  - uses: cdklabs/github-merit-badger@main\n    id: github-merit-badger\n    with:\n      github-token: ${{ secrets.GITHUB_TOKEN }}\n      badges: '[first-time-contributor,repeat-contributor,allstar-contributor]'\n      thresholds: '[0,1,5]'\n      ignore-usernames: '[kaizencc]'\n```\n\n### Ignore Teams\n\nSpecify one or more GitHub teams whose members should be ignored by the Action. This is a more scalable\nalternative to `ignore-usernames` as you don't need to manually maintain a list of individual\nusernames. Team membership is managed through GitHub Teams, making it easier to add or remove\nmaintainers without updating your workflow files.\n\nTeams should be specified in the format `\"[org/team-slug1,org/team-slug2]\"` where `org` is your GitHub\norganization name and `team-slug` is the team's slug (URL-friendly name). You can specify multiple teams.\n\n```yaml\nsteps:\n  - uses: cdklabs/github-merit-badger@main\n    id: github-merit-badger\n    with:\n      github-token: ${{ secrets.GITHUB_TOKEN }}\n      badges: '[first-time-contributor,repeat-contributor,allstar-contributor]'\n      thresholds: '[0,1,5]'\n      ignore-teams: '[aws/aws-cdk-team]'\n```\n\n**Note:** You can use both `ignore-usernames` and `ignore-teams` together, with all specified users and teams being excluded.\n\n**Requirements:** The GitHub token used must have permission to read team membership information.\nFor public teams, this works with standard repository permissions. For private teams, you may\nneed additional permissions.\n\n### Title Prefixes\n\nSpecify a list of title prefixes that the Action should accept. For example, the below code\nwill only count PRs with titles that begin with `feat` or `fix`. It will ignore PRs with other\ntitles like `chore` or `refactor`.\n\n```yaml\nsteps: \n  - uses: cdklabs/github-merit-badger@main\n    id: github-merit-badger\n    with:\n      github-token: ${{ secrets.GITHUB_TOKEN }}\n      badges: '[first-time-contributor,repeat-contributor,allstar-contributor]'\n      thresholds: '[0,1,5]'\n      title-prefixes: '[feat,fix]'\n```\n\nWhen kaizencc@ submits a PR, the Action will find that he has submitted 25 lifetime PRs to the repository, which is good for 2nd place. kaizencc@ will thus receive the `top 3 :fire:` badge on their PR.\n\n## Security\n\nSee [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.\n\n## License\n\nThis project is licensed under the Apache-2.0 License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdklabs%2Fgithub-merit-badger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdklabs%2Fgithub-merit-badger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdklabs%2Fgithub-merit-badger/lists"}