github webhook printing
1.0.0
用熱打印機打印(某些)GitHub Webhook事件。
mkdir -p /var/www/cgi/
git clone [email protected]:alifeee/github-webhook-printing.git
mv github-webhook-printing githubwebhooks
cd githubwebhooks
chown -R alifeee:www-data . apt install nginx fcgiwrap
service nginx start
echo ' server {
listen 80;
listen [::]:80;
server_name <server-address>;
location /githubwebhooks {
fastcgi_intercept_errors on;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/cgi/$fastcgi_script_name;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
} ' > /etc/nginx/sites-available/githubwebhook
ln -s /etc/nginx/sites-available/githubwebhook /etc/nginx/sites-enabled/githubwebhook
nginx -t
ufw allow 80
service nginx restartcurl " http://<server-address>/githubwebhooks/ping.cgi " 轉到GitHub用戶,存儲庫或組織設置頁> Webhooks。添加一個指向http://<server-address>/githubwebhooks/hook.cgi的網絡鉤。
發送一些Webhook請求(通過激活GitHub事件)。
將env輸出和數據從log文件複製並粘貼到文件中,例如webhook-examples/push.env和webhook-examples/push.json 。
將Webhook設置為指向http://<server-address>/githubwebhooks/hook.cgi
# push
curl -s --request POST -i -H " X-GITHUB-EVENT: push " " http://<server-address>/githubwebhooks/hook.cgi " -d " @webhook-examples/push.json "
# issue_comment
curl -s --request POST -i -H " X-GITHUB-EVENT: issue_comment " " http://<server-address>/githubwebhooks/hook.cgi " -d " @webhook-examples/issue_comment.json "
# create
curl -s --request POST -i -H " X-GITHUB-EVENT: create " " http://<server-address>/githubwebhooks/hook.cgi " -d " @webhook-examples/create.json "
# pull_request
curl -s --request POST -i -H " X-GITHUB-EVENT: pull_request " " http://<server-address>/githubwebhooks/hook.cgi " -d " @webhook-examples/pull_request.json "