{"id":15020790,"url":"https://github.com/electron/electron-website-updater","last_synced_at":"2025-10-19T16:33:03.073Z","repository":{"id":46359836,"uuid":"367194321","full_name":"electron/electron-website-updater","owner":"electron","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-22T02:10:33.000Z","size":565,"stargazers_count":3,"open_issues_count":0,"forks_count":5,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-10-29T17:15:38.553Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/electron.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-13T23:00:55.000Z","updated_at":"2024-10-22T02:10:35.000Z","dependencies_parsed_at":"2023-12-22T11:03:52.397Z","dependency_job_id":"cbcb342d-ba95-47d5-8cf8-294dd9643fe6","html_url":"https://github.com/electron/electron-website-updater","commit_stats":{"total_commits":29,"total_committers":5,"mean_commits":5.8,"dds":0.6551724137931034,"last_synced_commit":"4a2515b43b06456c6a7df6eb502c9bece792b663"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron%2Felectron-website-updater","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron%2Felectron-website-updater/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron%2Felectron-website-updater/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron%2Felectron-website-updater/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/electron","download_url":"https://codeload.github.com/electron/electron-website-updater/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237172244,"owners_count":19266638,"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-24T19:55:38.582Z","updated_at":"2025-10-19T16:32:57.778Z","avatar_url":"https://github.com/electron.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webhook\n\n[![Test](https://github.com/electron/electron-website-updater/actions/workflows/test.yml/badge.svg)](https://github.com/electron/electron-website-updater/actions/workflows/test.yml)\n\nThis project handles the webhooks from `electron/electron` and filters them\nto dispatch only the appropriate ones as `repository_dispatch` events to\n`electron/website` (\"that repo\").\n\nThese events are used to let that repo know there have been documentation changes.\n\nThis repo is subscribed to all `push` events in `electron/electron`. When\na payload comes it:\n\n1. Checks if there have been changes to the `/docs` folder\n1. Determines in what branch the commit has happend\n1. Sends a `repository_dispatch` with the following information:\n   * `sha`: the SHA of the commit received\n   * `branch`: the branch of the commit, usually something like `15-x-y`\n   * `event_type`:\n     * `doc_changes` if the changes have happened in the major release\n     * `doc_changes_previous` if the changes have happened in a previous major release\n\n## Local setup\n\nThe local setup uses a Personal Access Token instead of a GitHub Application\nto make the onboarding process faster.\n\n### Getting Code Locally\n\nIn order to be capable of testing this project you will have to:\n\n- Fork and clone locally `electron/electron`\n- Fork and clone locally `electron/electron-website-updater`:\n\n  ```console\n  git clone https://github.com/OWNER/electron-website-updater\n  cd electron-website-updater\n  yarn\n  ```\n\n### Configuring the webhooks\n\nYou will have to add a webhook to your fork of `electron/electron` and deliver\nthe payload to your local machine. To do that follow this steps:\n\n1. Go to [smee.io](https://smee.io/) and click **Start a new channel**.\n   You will be redirected to a new URL, this will be the webhook URL later on.\n1. Create a `.env` under `webhook/` with the contents of `webhook/.env.example`\n1. Create a new webhook in your `electron/electron` fork in\n   https://github.com/OWNER/electron/settings/hooks/new\n   - **Payload URL**: The URL from the first step.\n   - **Content type**: `application/json`\n   - **Secret**: `development`\n1. Create a new Personal Access Token (PAT) [here][pat] with the `repo` scope and\n   write it down.\n1. Use `webhook/.env.example` as the source to create `webhook/.env` file with the\n   following values:\n\n   ```\n   APP_ID=\n   CLIENT_ID=\n   CLIENT_SECRET=\n   CLIENT_PRIVATE_KEY=\n   INSTALLATION_ID=\n   GITHUB_TOKEN=%THE_PAT_CREATED_PREVIOUSLY%\n   WEBHOOK_SECRET=development\n   OWNER=%OWNER%\n   ```\n\n   The values that are empty are used only when using a GitHub App instead of a PAT.\n\n### Creating a GitHub App\n\nThis step is only necessary if you prefer this authentication approach over the PAT.\nGo [here to create a new GitHub App][github app] and use the following data (if something is not\nmentioned, you can leave the defaults):\n\n- GitHub App name: Electron Website Updater\n- Homepage URL: https://github.com/OWNER/website\n- Webhook: deactivated\n- Repository permissions:\n  - Contents - Read \u0026 write\n- Subscribe to events: None, we will configure the payload manually\n- Where can this GitHub App be installed? Only in this account\n\nWrite down the following information:\n\n- App ID\n- Client ID\n- Client secret: You might need to generate a new one\n- Private key: You might need to generate a new one. The private key will be downloaded to your machine,\n  open it and `JSON.stringify` the contents.\n\nYou will have to install the application now in your org and obtain the installation id. To do\nso you can use the following snippet (and install the required depdendencies):\n\n```js\nconst { createAppAuth } = require('@octokit/auth-app');\nconst { Octokit } = require('@octokit/rest');\n\nconst start = async () =\u003e {\n  const appOctokit = new Octokit({\n    authStrategy: createAppAuth,\n    auth: {\n      appId: process.env.APP_ID,\n      privateKey: JSON.parse(process.env.CLIENT_PRIVATE_KEY),\n      // installationId: process.env.INSTALLATION_ID,\n      clientId: process.env.CLIENT_ID,\n      clientSecret: process.env.CLIENT_SECRET,\n    },\n  });\n\n  const { data } = await appOctokit.request('/app/installations');\n\n  // If you've only installed it once, this should be the one\n  const installationId = data[0].app_id;\n\n  console.log(installationId);\n};\n\nstart();\n```\n\nCreate then a `webhook/.env` file with the following values:\n\n```\nAPP_ID=%APP_ID%\nCLIENT_ID=%CLIENT_ID%\nCLIENT_SECRET=%CLIENT_SECRET%\nCLIENT_PRIVATE_KEY=%STRINGIFY_PRIVATE_KEY%\nINSTALLATION_ID=%INSTALLATION_ID%\nGITHUB_TOKEN=\nWEBHOOK_SECRET=development\nOWNER=%OWNER%\n```\n\nThe value of `CLIENT_PRIVATE_KEY` should look similar to (pay attention to the initial `'\"`):\n\n```\n'\"-----BEGIN RSA PRIVATE KEY-----\\n...\\n-----END RSA PRIVATE KEY-----\\n\"'\n```\n\n### Running the code locally\n\nTo run the code locally you need to launch 2 processes:\n\n- the `smee` process with the right URL you got earlier\n- the webhook server process\n\nThe easiest way to do this is to use VS Code (opening at the root of this repo, not `/webhook`)\nand select the task `webhook local debugging`.\n\n![vs code debugging targets](./img/webhook-local-debugging.png)\n\nOnce you run this task (select and press F5), you will be prompted with the smee URL.\nPaste it and it will start the smee tunnel and the local server listening on the port 3000.\n\n![VS Code prompt for the smee url](./img/smee-url-prompt.png)\n\nIf you prefer to do this manually you will have to open 2 terminals and run the following\nfrom the `/webhook` folder:\n\n1. `yarn smee --target THE_SMEE_WEBHOOK_URL`\n2. `node index.js`\n\n### Testing the webhooks locally\n\nOnce you have done all of the above, your local server should receive payloads for the\nfollowing scenarios:\n\n* `push`: Push any change to the right branch of `electron/electron`\n* `release`: From the releases page of your `electron/electron` fork\n  (https://github.com/OWNER/electron/releases), create a new release\n\n## Running the tests\n\nTests for `/webhook` are written using Node's test runner, and run from the root of the repo:\n\n```console\nyarn test\n```\n\nTest files should be close to the files they are testing under a folder `__tests__`.\n\n[pat]: https://github.com/settings/tokens\n[github app]: https://github.com/settings/apps/new\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectron%2Felectron-website-updater","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felectron%2Felectron-website-updater","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectron%2Felectron-website-updater/lists"}