Skip to content

Latest commit

 

History

History
40 lines (27 loc) · 1.05 KB

File metadata and controls

40 lines (27 loc) · 1.05 KB

generate-webhook-events

This is a script for generating all_webhooks.go.

It does:

  1. Fetch the GitHub Docs HTML page
  2. Parse the HTML and find webhook names and their activity types from tables
  3. Generate mappings from webhook names to their activity types as a Go map variable

Usage

generate-webhook-events [[srcfile] dstfile]

Generate all_webhooks.go file:

go run ./scripts/generate-webhook-events ./all_webhooks.go

When the HTML file is in local:

go run ./scripts/generate-webhook-events ./input.html ./all_webhooks.go

For debugging, specifying - to dstfile outputs the generated source to stdout:

go run ./scripts/generate-webhook-events ./input.html -

Notes

  • Not applicable activity types are generated as an empty slice: []string{}
  • Custom activity types are generated as nil
  • The output is sorted by webhook name so the generated file is stable