{"id":14969261,"url":"https://github.com/cucumber/commitbit","last_synced_at":"2025-03-04T10:15:03.493Z","repository":{"id":54575247,"uuid":"98053775","full_name":"cucumber/commitbit","owner":"cucumber","description":"Microservice that hands out commit bit to everyone who gets a pull request merged","archived":false,"fork":false,"pushed_at":"2023-09-28T12:06:05.000Z","size":92,"stargazers_count":2,"open_issues_count":8,"forks_count":1,"subscribers_count":97,"default_branch":"master","last_synced_at":"2024-10-29T14:46:52.988Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cucumber.png","metadata":{"funding":{"open_collective":"cucumber"},"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-07-22T19:37:16.000Z","updated_at":"2023-02-08T08:48:19.000Z","dependencies_parsed_at":"2023-12-26T13:04:23.478Z","dependency_job_id":"24359206-042d-48d5-8192-5a72a8b867c6","html_url":"https://github.com/cucumber/commitbit","commit_stats":{"total_commits":22,"total_committers":5,"mean_commits":4.4,"dds":"0.31818181818181823","last_synced_commit":"e40b15a13b612f7617751ca9eaa2ebfb84be72f0"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cucumber%2Fcommitbit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cucumber%2Fcommitbit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cucumber%2Fcommitbit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cucumber%2Fcommitbit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cucumber","download_url":"https://codeload.github.com/cucumber/commitbit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240312508,"owners_count":19781631,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-09-24T13:41:27.325Z","updated_at":"2025-03-04T10:15:03.452Z","avatar_url":"https://github.com/cucumber.png","language":"JavaScript","funding_links":["https://opencollective.com/cucumber"],"categories":[],"sub_categories":[],"readme":"# Commit bit\n\n![commitbit](commitbit.png)\n\nCommit bit is a micro service that hands out a commit bit to contributors\nafter their first GitHub pull request has been merged.\n\nThis liberal policy reduces the workload of the existing team and lowers the barrier\nof entry for new team members.\n\nThe rest of this document explains how to configure and install the commit bit\nmicro service.\n\n## Install dependencies\n\nInstall Node.js. Then install library dependencies:\n\n    npm install\n\n## Create a personal auth token\n\nCreate a [personal auth token](https://github.com/settings/tokens) with the\nfollowing scopes:\n\n* `repo` - to comment on pull requests\n* `admin:org` - to add contributors to the committers team\n\nDefine the token in an environment variable:\n\n    export GITHUB_AUTH_TOKEN=REPLACE-WITH-YOUR-AUTH-TOKEN-HERE\n\n## Define a secret for the WebHook\n\n    export GITHUB_WEBHOOK_SECRET=$(openssl rand -base64 32 | tr -s '/' '-')\n\n## Create a committers team\n\nCreate a [GitHub Team](https://help.github.com/articles/organizing-members-into-teams/)\ncalled `committers` (or something similar), which is the team new contributors will\nbe added to.\n\nDefine the id of the team:\n\n    export GITHUB_TEAM_ID=$(./team-id REPLACE-WITH-YOUR-ORG-NAME-HERE REPLACE-WITH-YOUR-TEAM-NAME-HERE)\n\n## Grant team members write access on select repos\n\nAdd all repositories you want to give commit bit for to the team. Grant at least write access.\n\n## Create a welcome message template\n\nWhen a contributor is added to the committers team, a comment is also made on the\npull request welcoming the contributor. You should customise this message to your\nown project.\n\nCopy `welcome.ejs.template` to `welcome.ejs`. Change the contents of the file to\nwhat you want.\n\n## Deploy the service\n\nThe service gets deployed to [AWS Lambda](https://aws.amazon.com/lambda).\nYou need to define two environment variables:\n\n    export AWS_ACCESS_KEY_ID=REPLACE-WITH-YOUR-AWS-ACCESS-KEY-ID\n    export AWS_SECRET_ACCESS_KEY=REPLACE-WITH-YOUR-AWS-SECRET-ACCESS-KEY\n\n*The Cucumber team keeps these values in [1Password](https://1password.com/). Create a new GitHub issue if you want \naccess to these tokens in 1Password so you can deploy a new version*.\n\nNow, deploy the service.\n\n    ./deploy\n\nAfter the first deploy you can redeploy faster:\n\n    serverless deploy function --function githubWebhookListener\n\n## Install WebHook\n\nInstall a Github *organization wide* WebHook by going to `https://github.com/organizations/REPLACE-WITH-YOUR-ORG-NAME-HERE/settings/hooks`\n\nFind the WebHook URL:\n\n    serverless info | grep POST | tr -s ' ' | cut -d' ' -f4\n\nAnd remind yourself of the the secret:\n\n    echo $GITHUB_WEBHOOK_SECRET\n\nFill in the WebHook form with those values, and specify Content type `application/json`.\n\nFinally, select only the *Pull request* event.\n\n## That's it\n\nWhenever a pull request is merged, the user who submitted the pull request will\nbe added to the committers team, which will give them write access to repositories.\n\nContributors will also receive a welcome message (in the pull request) when they get\nadded.\n\n## Why are there no tests?\n\nTesting this code in a real environment (against GitHub) would require creating\nreal pull requests, merging them and inspecting whether people were added to a team,\nand whether the pull request received a comment. That's a pretty complex test harness\nto set up.\n\nAnother testing strategy would be to decouple the domain logic from GitHub.\nThat would give us confidence that the domain logic (if statements) are working,\nbut it wouldn't give us much confidence that the whole system works.\n\nIn the end, it seemed that manual testing was sufficient for this kind of application.\nIt's easy to (re)invoke webhooks from GitHub's admin panel and inspect results -\na lot easier than it would have been to decouple this code and write automated tests\nfor it.\n\nFor a bigger application with more logic it would make sense, but for this application,\nmanual testing seemed like the right thing to do.\n\n## Credit\n\nThe commitbit microservice is based on [Serverless Github webhook listener](https://github.com/serverless/examples/tree/master/aws-node-github-webhook-listener)\nfrom the [Serverless Framework](https://serverless.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcucumber%2Fcommitbit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcucumber%2Fcommitbit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcucumber%2Fcommitbit/lists"}