{"id":15691621,"url":"https://github.com/azu/parse-github-event","last_synced_at":"2025-05-07T23:46:23.125Z","repository":{"id":16403088,"uuid":"19153997","full_name":"azu/parse-github-event","owner":"azu","description":"A small library to parse Github Event Types which is API response.","archived":false,"fork":false,"pushed_at":"2023-08-22T04:29:12.000Z","size":45,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-20T04:34:17.173Z","etag":null,"topics":["api","github","javascript","json","message","rest"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/azu.png","metadata":{"funding":{"github":"azu"},"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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}},"created_at":"2014-04-25T17:11:11.000Z","updated_at":"2024-08-05T19:07:24.000Z","dependencies_parsed_at":"2024-10-23T23:09:10.767Z","dependency_job_id":"b2c00d56-6169-4499-ab74-d02e7b0fec46","html_url":"https://github.com/azu/parse-github-event","commit_stats":{"total_commits":57,"total_committers":3,"mean_commits":19.0,"dds":0.1578947368421053,"last_synced_commit":"06cb8037ee0790a5b9aff6f9345f7d96398864e9"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fparse-github-event","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fparse-github-event/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fparse-github-event/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azu%2Fparse-github-event/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azu","download_url":"https://codeload.github.com/azu/parse-github-event/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252973618,"owners_count":21834105,"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":["api","github","javascript","json","message","rest"],"created_at":"2024-10-03T18:22:32.969Z","updated_at":"2025-05-07T23:46:23.105Z","avatar_url":"https://github.com/azu.png","language":"TypeScript","readme":"# parse-github-event [![Build Status](https://travis-ci.org/azu/parse-github-event.svg)](https://travis-ci.org/azu/parse-github-event)\n\nSmall library to parse [Event Types](https://developer.github.com/v3/activity/events/types/ \"Event Types\") from Github API response.\n\n## Feature\n\n- Parse event json and built message and html_url without addtional request\n- Create human-readable message like GitHub's timeline from event json\n\n## Installation\n\n``` sh\nnpm install parse-github-event\n```\n\n## Usage\n\nResponse json object of [GitHub Events API](https://developer.github.com/v3/activity/events/).\n\n``` json\n{\n    \"id\": \"2070416128\",\n    \"type\": \"PullRequestEvent\",\n    \"actor\": {\n        \"id\": 1062518,\n        \"login\": \"pivotal-brian-croom\",\n        \"gravatar_id\": \"92d36bd6d9b53539fcec282452872710\",\n        \"url\": \"https://api.github.com/users/pivotal-brian-croom\",\n        \"avatar_url\": \"https://avatars.githubusercontent.com/u/1062518?\"\n    },\n    \"repo\": {\n        \"id\": 708684,\n        \"name\": \"pivotal/cedar\",\n        \"url\": \"https://api.github.com/repos/pivotal/cedar\"\n    },\n    \"payload\": {\n        \"action\": \"opened\",\n        \"number\": 231,\n        \"pull_request\": {\n            \"url\": \"https://api.github.com/repos/pivotal/cedar/pulls/231\",\n            \"body\": \"- Common code consolidated into CDROTestRunner and CDROTestIPhoneRunner\\r\\n- CDROTestIPhoneRunner subclasses CDROTestRunner\\r\\n[#67878220]\\r\\n\\r\\nThoughts?\\r\\n@idoru, @jeffh\",\n            \"created_at\": \"2014-04-24T05:01:39Z\",\n            \"updated_at\": \"2014-04-24T05:01:39Z\",\n    ...\n}\n```\n\n### Parse response\n\n``` js\nvar parseGithubEvent = require(\"parse-github-event\");\n// responseJSON is come from https://developer.github.com/v3/activity/events/\nvar parsed = parseGithubEvent.parse(responseJSON);\n/*\n{\n    text: 'opened issue on %%repository%%',\n    data: { repository: 'pivotal/cedar' },\n    html_url : 'https://github.com/pivotal/cedar/pull/231'\n}\n*/\n```\n\n### Create message\n\nIt's bonus method.\n\n``` js\nvar parseGithubEvent = require(\"parse-github-event\");\nvar result = parseGithubEvent.compile(json);\n// pivotal-brian-croom opened issue on pivotal/cedar\n```\n\n## UseCase\n\nCreate one-line message and html_url from event response.\n\n- [azu/github-to-twitter-lambda: Lambda bot that fetch own GitHub notifications/events and post to Twitter.](https://github.com/azu/github-to-twitter-lambda)\n- [azu/faao: Faao is a GitHub issue/pull-request client on Electron.](https://github.com/azu/faao)\n- [lawvs/buddy-github-events: View broadcast/received GItHub events from other people or organizations.](https://github.com/lawvs/buddy-github-events)\n\n## Contributing\n\n1. Fork it!\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request :D\n\n## License\n\nMIT\n\nThanks for [alindeman/github-timeline-widget](https://github.com/alindeman/github-timeline-widget \"alindeman/github-timeline-widget\").\n\nUse these as a reference\n\n* https://github.com/FenrirUnbound/github-feed/tree/FixPath/test/mocks\n* https://github.com/limbo0312/gitBox/tree/master/ioctocat2/iOctocatUnitTests/Fixtures\n* https://github.com/octokit/go-octokit/tree/master/fixtures\n* https://github.com/chamerling/QuickHubApp\n* https://github.com/linyows/octospy/tree/master/spec/fixtures\n* https://github.com/octokit/octokit.objc/tree/master/OctoKitTests/Stubs\n* https://github.com/octokit/octokit.net/tree/master/Octokit.Tests/Fixtures\n","funding_links":["https://github.com/sponsors/azu"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazu%2Fparse-github-event","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazu%2Fparse-github-event","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazu%2Fparse-github-event/lists"}