All Projects → xPaw → GitHub-WebHook

xPaw / GitHub-WebHook

Licence: MIT License
🐱 Validates and processes GitHub's webhooks

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to GitHub-WebHook

ruby-marshal
Haskell library to parse a subset of Ruby objects serialised with Marshal.dump
Stars: ✭ 30 (+20%)
Mutual labels:  parsing
Lith
WeeChat relay client
Stars: ✭ 32 (+28%)
Mutual labels:  irc
MimeParser
Mime parsing in Swift | Relevant RFCs: RFC 822, RFC 2045, RFC 2046
Stars: ✭ 18 (-28%)
Mutual labels:  parsing
bancho.js
Interface with Bancho over IRC, made easy and reliable.
Stars: ✭ 47 (+88%)
Mutual labels:  irc
node-typescript-parser
Parser for typescript (and javascript) files, that compiles those files and generates a human understandable AST.
Stars: ✭ 121 (+384%)
Mutual labels:  parsing
dataconf
Simple dataclasses configuration management for Python with hocon/json/yaml/properties/env-vars/dict support.
Stars: ✭ 40 (+60%)
Mutual labels:  parsing
CYK-Parser
A CYK parser written in Python 3.
Stars: ✭ 24 (-4%)
Mutual labels:  parsing
desktop
Extendable calculator for the 21st Century ⚡
Stars: ✭ 85 (+240%)
Mutual labels:  parsing
pdfmajor
A better PDF Extraction Tool using the latest and fastest python features
Stars: ✭ 19 (-24%)
Mutual labels:  parsing
json2object
Type safe Haxe/JSON (de)serializer
Stars: ✭ 54 (+116%)
Mutual labels:  parsing
structures
Declarative binary data builder and parser: simple, fast, extensible
Stars: ✭ 29 (+16%)
Mutual labels:  parsing
LR
explore different techniques to generate LR(k) parsing code
Stars: ✭ 13 (-48%)
Mutual labels:  parsing
Miksilo
The fastest way to build a language
Stars: ✭ 27 (+8%)
Mutual labels:  parsing
YaccConstructor
Platform for parser generators and other grammarware research and development. GLL, RNGLR, graph parsing algorithms, and many others are included.
Stars: ✭ 36 (+44%)
Mutual labels:  parsing
libcitygml
C++ Library for CityGML Parsing and Visualization
Stars: ✭ 69 (+176%)
Mutual labels:  parsing
Jsonify
♨️A delightful JSON parsing framework.
Stars: ✭ 42 (+68%)
Mutual labels:  parsing
humanparser
Parse a human name string into salutation, first name, middle name, last name, suffix.
Stars: ✭ 78 (+212%)
Mutual labels:  parsing
hxjsonast
Parse JSON into position-aware AST with Haxe!
Stars: ✭ 28 (+12%)
Mutual labels:  parsing
ohm-editor
An IDE for the Ohm language (JavaScript edition)
Stars: ✭ 78 (+212%)
Mutual labels:  parsing
alertmanager-irc-relay
Send Prometheus Alerts to IRC using Webhooks
Stars: ✭ 44 (+76%)
Mutual labels:  irc

This script acts as a web hook for GitHub events, processes them, and returns messages which can be sent out to an IRC channel or a Discord webhook, depending on the converter used.

See examples/discord.php for a basic application that sends webhooks to Discord.
See examples/irker.php for a basic application that sends messages to IRC.

GitHubWebHook

GitHubWebHook.php accepts, processes and validates an event, it also can make sure that the event came from a GitHub server.

Functions in this class are:

ProcessRequest()

Accepts an event, throws Exception on error.

GetEventType()

Returns event type. See https://developer.github.com/webhooks/#events for a list of events.

GetPayload()

Returns decoded JSON payload as an object.

GetFullRepositoryName()

Returns full name of the repository for which an event was sent for.

ValidateHubSignature( $SecretKey )

Retuns true if HMAC hex digest of the payload matches GitHub's, false otherwise.

ValidateIPAddress()

Returns true if a request came from GitHub's IP range, false otherwise. Use ValidateHubSignature instead.

IrcConverter

IrcConverter.php accepts input from previous script and outputs a colored string which can be sent to IRC.

__construct( $EventType, $Payload, $URLShortener = null )

IrcConverter constructor takes 3 paramaters (last one is optional). All you need to do is pass data after parsing the message with GitHubWebHook like so: new IrcConverter( $Hook->GetEventType(), $Hook->GetPayload() );

URL shortener paramater takes a function, and that function should accept a single string argument containing an url. If your function fails to shorten an url or do anything with it, your function must return the original url back.

GetMessage()

After calling the constructor, using this function will return a string which can be sent to an IRC server.

Throws NotImplementedException when you pass an event that is not parsed anyhow, and throws IgnoredEventException for fork, watch and status events which are ignored by design.

Events [ref]

Track changes to GitHub webhook payloads documentation here: https://github.com/github/docs/commits/main/data/reusables/webhooks

Supported events

  • commit_comment
  • delete
  • discussion
  • discussion_comment
  • gollum
  • issue_comment
  • issues
  • member
  • milestone
  • package
  • ping
  • project
  • public
  • pull_request
  • pull_request_review
  • pull_request_review_comment
  • push
  • release
  • repository
  • repository_vulnerability_alert

Not yet supported events

  • check_run
  • check_suite
  • code_scanning_alert
  • deploy_key
  • deployment
  • deployment_status
  • label
  • membership
  • meta
  • org_block
  • organization
  • page_build
  • project_card
  • project_column
  • repository_import
  • sponsorship
  • team
  • team_add

Events ignored by design

  • create - Formatted from push event instead
  • fork
  • star
  • status
  • watch

Additionally, events like labelling or assigning an issue are also ignored. Push event ignores branch deletions (use delete event instead).

Events that can not be supported

  • content_reference
  • github_app_authorization
  • installation
  • installation_repositories
  • marketplace_purchase
  • repository_dispatch
  • security_advisory
  • workflow_dispatch
  • workflow_run

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].