Cleanup
This commit is contained in:
@@ -3,7 +3,6 @@ import 'dotenv/config'
|
||||
import * as env from 'env-var'
|
||||
import { PushWebhook } from "./PushWebhook";
|
||||
import { exec } from "child_process";
|
||||
import { promisify } from "util";
|
||||
|
||||
const app: Application = express()
|
||||
|
||||
@@ -29,11 +28,10 @@ async function parsePushHook(webhook: PushWebhook) {
|
||||
.replace(/\//gi, '_')
|
||||
const safeTag = tag
|
||||
.replace(/[^a-z0-9-]/gi, '')
|
||||
const safeResourceUri = tag
|
||||
const safeResourceUri = resource_url
|
||||
.replace(/[^a-z0-9-./:]/gi, '')
|
||||
try {
|
||||
const cmd = `${rootDir}/${safeFilename}.sh ${safeTag} ${safeResourceUri}`
|
||||
console.log(cmd)
|
||||
await new Promise(((resolve, reject) => {
|
||||
exec(cmd, (err, stdout, stderr) =>
|
||||
(err || stderr) ? reject(err || stderr) : resolve(stdout)
|
||||
@@ -51,7 +49,6 @@ app.post('/', async (req: Request, res: Response) => {
|
||||
return
|
||||
}
|
||||
const body: PushWebhook = req.body
|
||||
console.log(JSON.stringify(body, null, 2))
|
||||
if (body?.type !== "PUSH_ARTIFACT") {
|
||||
res.status(400).json({msg: "Only push hooks are allowed!"})
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user