Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

github webhook to github actions workflow dispatch

node v16.18.0
version: 1.0.0
endpointsharetweet
const got = require('got') const express = require("@runkit/runkit/express-endpoint/1.0.0") const bodyParser = require("body-parser") const app = express(exports) app.use(bodyParser.urlencoded()) app.use("/", (req, res, next) => { if (!req.query.key || req.query.key !== process.env.WEBHOOK_KEY) { return res.status(403).send("forbidden") } return next() }) app.all("*", async (req, res) => { const result = await got.post("https://api.github.com", { path: req.path, headers: { "Authorization": "token " + process.env.GH_PAT, "Accept": "application/vnd.github.v3+json" }, json: { ref: "master" }, responseType: 'json' }) return res.send(result.statusCode) })
Loading…

no comments

    sign in to comment