Skip to content

Commit

Permalink
Stop uninstalling the App automatically
Browse files Browse the repository at this point in the history
It's not really what we want to do here, even if it was fun over in the
LeaveMeAlone GitHub App.

Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dscho committed Dec 1, 2022
1 parent 0527ddd commit 8a941c8
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions GitForWindowsHelper/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
const validateGitHubWebHook = require('./validate-github-webhook')

/** Sends a JWT-authenticated GitHub API request */
const gitHubApiRequestAsApp = require('./github-api-request-as-app')

module.exports = async function (context, req) {
const withStatus = (status, headers, body) => {
context.res = {
Expand All @@ -23,22 +20,6 @@ module.exports = async function (context, req) {
return withStatus(403, undefined, `Go away, you are not a valid GitHub webhook: ${e}`)
}

if (req.headers['x-github-event'] === 'installation' && req.body.action === 'created') {
try {
const res = await gitHubApiRequestAsApp(context, 'DELETE', `/app/installations/${req.body.installation.id}`)
context.log(`Deleted installation ${req.body.installation.id} on ${req.body.repositories.map(e => e.full_name).join(", ")}`)
context.log(res)
context.res = {
status: 200,
body: `Deleted installation`,
}
} catch (e) {
context.log(e)
return withStatus(500, undefined, `Error:\n${e}`)
}
return
}

context.log("Got headers")
context.log(req.headers)
context.log("Got body")
Expand Down

0 comments on commit 8a941c8

Please sign in to comment.