{"id":21247740,"url":"https://github.com/jasterv/api--github-webhooks","last_synced_at":"2025-03-15T05:15:53.461Z","repository":{"id":46129839,"uuid":"426031529","full_name":"JasterV/api--github-webhooks","owner":"JasterV","description":"An API Rest built with Deno to catch github webhook events","archived":false,"fork":false,"pushed_at":"2021-11-14T20:06:48.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-07T21:32:55.494Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JasterV.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-08T23:55:02.000Z","updated_at":"2021-11-14T19:55:37.000Z","dependencies_parsed_at":"2022-09-23T06:21:59.233Z","dependency_job_id":null,"html_url":"https://github.com/JasterV/api--github-webhooks","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JasterV%2Fapi--github-webhooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JasterV%2Fapi--github-webhooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JasterV%2Fapi--github-webhooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JasterV%2Fapi--github-webhooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JasterV","download_url":"https://codeload.github.com/JasterV/api--github-webhooks/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243685587,"owners_count":20330983,"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-11-21T02:43:52.907Z","updated_at":"2025-03-15T05:15:53.440Z","avatar_url":"https://github.com/JasterV.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deno github webhook server\n\nAn API Rest built with Deno to catch github events\n\n## Run\n\n```sh\nmake start\n```\n\n## Github webhook secret\n\nWhen creating a github webhook from the repository webhooks UI, we need to\nprovide a secret token.\n\nGithub is going to hash this token using a Hmac algorithm and send it to us\nusing the 'X-Hub-Signature-256' header.\n\nIn order to secure our endpoint, we must set a middleware that signs our secret\nusing the same Hmac algorithm and checks if it matches with the received hash.\n\nExample:\n\n```typescript\nconst hash = request.headers.get(\"X-Hub-Signature-256\");\nconst signature = \"sha256=\" +\n  hmac(\"sha256\", secret, JSON.stringify(req.body)).hex();\nif (hash !== signature) {\n  // Return an unauthorized error\n}\nnext();\n```\n\n## Get the github event\n\nWe can get the github event from the `x-github-event` header. Then, to get more\ndata about this event we can look at the payload received in the body of the\nrequest.\n\n## Actions file\n\nThe actions file defines which commands to execute when a certain event is\nreceived.\n\nExample:\n\n```yaml\nactions:\n  - on: push\n    command: \"echo 'Hello World'\"\n  - on: pull_request\n    command: \n      - \"mkdir ./patata\"\n      - \"rmdir ./patata\"\n      - \"touch patata/mypatata.txt\"\n      - \"tree patata\"\n```\n\nRight now it only supports push, pull requests and issues, and does not support\nspecifying a branch. But it will be implemented on demand (For sure I want to be\nable to trigger the push event only when it happens on a certain branch).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasterv%2Fapi--github-webhooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasterv%2Fapi--github-webhooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasterv%2Fapi--github-webhooks/lists"}