{"id":15048212,"url":"https://github.com/github/github-app-js-sample","last_synced_at":"2025-05-16T12:03:23.461Z","repository":{"id":165518056,"uuid":"620398419","full_name":"github/github-app-js-sample","owner":"github","description":"Sample of a GitHub App that comments new pull requests","archived":false,"fork":false,"pushed_at":"2025-02-20T18:32:02.000Z","size":143,"stargazers_count":134,"open_issues_count":4,"forks_count":190,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-04-12T08:37:37.846Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/github.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":"CODEOWNERS","security":"SECURITY.md","support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-28T15:49:16.000Z","updated_at":"2025-04-10T14:19:43.000Z","dependencies_parsed_at":"2024-10-17T04:55:30.371Z","dependency_job_id":"a99a83f5-f280-495b-9d6e-44afd6ab245e","html_url":"https://github.com/github/github-app-js-sample","commit_stats":{"total_commits":27,"total_committers":6,"mean_commits":4.5,"dds":0.4814814814814815,"last_synced_commit":"877f4b927231f60108cedeb6495954508e7ffbd8"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fgithub-app-js-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fgithub-app-js-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fgithub-app-js-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fgithub-app-js-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/github","download_url":"https://codeload.github.com/github/github-app-js-sample/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254527084,"owners_count":22085918,"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-24T21:09:17.572Z","updated_at":"2025-05-16T12:03:23.388Z","avatar_url":"https://github.com/github.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sample GitHub App\n\nThis sample app showcases how webhooks can be used with a GitHub App's installation token to create a bot that responds to issues. Code uses [octokit.js](https://github.com/octokit/octokit.js).\n\n## Requirements\n\n- Node.js 20 or higher\n- A GitHub App subscribed to **Pull Request** events and with the following permissions:\n  - Pull requests: Read \u0026 write\n  - Metadata: Read-only\n- (For local development) A tunnel to expose your local server to the internet (e.g. [smee](https://smee.io/), [ngrok](https://ngrok.com/) or [cloudflared](https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide/local/))\n- Your GitHub App Webhook must be configured to receive events at a URL that is accessible from the internet.\n\n## Setup\n\n1. Clone this repository.\n2. Create a `.env` file similar to `.env.example` and set actual values. If you are using GitHub Enterprise Server, also include a `ENTERPRISE_HOSTNAME` variable and set the value to the name of your GitHub Enterprise Server instance.\n3. Install dependencies with `npm install`.\n4. Start the server with `npm run server`.\n5. Ensure your server is reachable from the internet.\n    - If you're using `smee`, run `smee -u \u003csmee_url\u003e -t http://localhost:3000/api/webhook`.\n6. Ensure your GitHub App includes at least one repository on its installations.\n\n## Usage\n\nWith your server running, you can now create a pull request on any repository that\nyour app can access. GitHub will emit a `pull_request.opened` event and will deliver\nthe corresponding Webhook [payload](https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request) to your server.\n\nThe server in this example listens for `pull_request.opened` events and acts on\nthem by creating a comment on the pull request, with the message in `message.md`,\nusing the [octokit.js rest methods](https://github.com/octokit/octokit.js#octokitrest-endpoint-methods).\n\n## Security considerations\n\nTo keep things simple, this example reads the `GITHUB_APP_PRIVATE_KEY` from the\nenvironment. A more secure and recommended approach is to use a secrets management system\nlike [Vault](https://www.vaultproject.io/use-cases/key-management), or one offered\nby major cloud providers:\n[Azure Key Vault](https://learn.microsoft.com/en-us/azure/key-vault/secrets/quick-create-node?tabs=windows),\n[AWS Secrets Manager](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-secrets-manager/),\n[Google Secret Manager](https://cloud.google.com/nodejs/docs/reference/secret-manager/latest),\netc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fgithub-app-js-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithub%2Fgithub-app-js-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fgithub-app-js-sample/lists"}