-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 49f1f43
Showing
72 changed files
with
7,803 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# This file specifies files that are *not* uploaded to Google Cloud Platform | ||
# using gcloud. It follows the same syntax as .gitignore, with the addition of | ||
# "#!include" directives (which insert the entries of the given .gitignore-style | ||
# file at that point). | ||
# | ||
# For more information, run: | ||
# $ gcloud topic gcloudignore | ||
# | ||
.gcloudignore | ||
# If you would like to upload your .git directory, .gitignore file or files | ||
# from your .gitignore file, remove the corresponding line | ||
# below: | ||
.git | ||
.gitignore | ||
|
||
.vscode | ||
|
||
node_modules |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const axios = require('axios') | ||
|
||
const BLUE = 3447003; | ||
const RED = 15158332; | ||
const GREEN = 3066993; | ||
|
||
module.exports.subscribeDiscord = function(event, context) { | ||
const build = eventToBuild(event.data) | ||
const status = ['WORKING', 'SUCCESS', 'FAILURE', 'INTERNAL_ERROR', 'TIMEOUT'] | ||
|
||
if (!status.includes(build.status)) return; | ||
|
||
const buildStatus = build.status | ||
const substitutions = build.substitutions | ||
const branch = substitutions.BRANCH_NAME | ||
const repo = substitutions.REPO_NAME | ||
const commit = substitutions.COMMIT_SHA | ||
const commitUrl = `https://github.com/radiuszon/${repo}/commit/${commit}` | ||
|
||
axios.post(process.env.DISCORD_WEBHOOK_URL, { | ||
embeds: [{ | ||
title: `${repo}@${branch} is currently ${buildStatus.toLowerCase()}`, | ||
description: `commit ${commit}`, | ||
color: getColor(buildStatus), | ||
url: commitUrl | ||
}] | ||
}) | ||
} | ||
|
||
const eventToBuild = (data) => { | ||
return JSON.parse(Buffer.from(data, 'base64').toString()) | ||
} | ||
|
||
const getColor = statusIndex => ({SUCCESS: GREEN, WORKING: BLUE}[statusIndex] || RED) |
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.