Created
August 5, 2020 16:10
-
-
Save littledivy/0074a0c41be57626c94fb97029e0f8f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const app = express(); | |
const http = require('http'); | |
const fs = require('fs'); | |
app.post("/payload", (req, res, next) => { | |
getRelease(req.body) | |
}); | |
function getRelease(payload) { | |
if(payload.action == "published") { | |
var r = payload.release.assets.find(x => x.name == "nest-api-rust"); | |
if(r) { | |
const file = fs.createWriteStream("nest-api-rust"); | |
const request = http.get(r.browser_download_url , function(response) { | |
response.pipe(file); | |
}); | |
} | |
} | |
} | |
app.listen(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment