GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — chanify/plugin/webhook/github.lua at main · JbGoingdown/chanify

Expand file tree

/

github.lua

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
36 lines (29 loc) · 1 KB
/

github.lua

Copy path

File metadata and controls

36 lines (29 loc) · 1 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
-- Github Webhook Event
-- Ref: https://docs.github.com/en/developers/webhooks-and-events/webhooks
local hex = require 'hex'
local json = require 'json'
local crypto = require'crypto'
local seckey = ctx:env("SECRET_TOKEN")
local req = ctx:request()
local sign = hex.decode(req:header("X-HUB-SIGNATURE-256"):sub(8))
if not crypto.equal(crypto.hmac("sha256", seckey, req:body()), sign) then
return 401
end
local data = json.decode(req:body())
local event = req:header("X-GitHub-Event")
local msg = ""
if event == "push" then
msg = string.format("push commit:\n%s", data["head_commit"]["message"])
elseif event == "release" then
msg = string.format("release %s %s", data["release"]["tag_name"], data["action"])
elseif event == "issues" then
msg = string.format("issues %s:\n%s", data["action"], data["issue"]["title"])
else
msg = string.format("%s %s", event, data["action"])
end
local ret = ctx:send({
title = "Github " .. data["repository"]["full_name"],
text = msg,
sound = req:query("sound"),
})
return 200, ret
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.