-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from toko-bifrost/release/v3
Release/v3
- Loading branch information
Showing
22 changed files
with
516 additions
and
236 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
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules | ||
node_modules | ||
.DS_Store |
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
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
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,7 @@ | ||
export const CONCLUSION_THEMES: any = { | ||
neutral: "5DB1D1", | ||
success: "90C978", | ||
cancelled: "D99294", | ||
timed_out: "FF756D", | ||
failure: "C23B23", | ||
}; |
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,8 @@ | ||
import { setFailed } from "@actions/core"; | ||
import { formatAndNotify } from "./utils"; | ||
|
||
try { | ||
formatAndNotify("start"); | ||
} catch (error) { | ||
setFailed(error.message); | ||
} |
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,37 @@ | ||
import { Octokit } from "@octokit/rest"; | ||
import { WebhookBody } from "../models"; | ||
import { getInput } from "@actions/core"; | ||
import { CONCLUSION_THEMES } from "../constants"; | ||
|
||
export function formatCompactLayout( | ||
commit: Octokit.Response<Octokit.ReposGetCommitResponse>, | ||
status: string, | ||
elapsedSeconds?: number | ||
) { | ||
const author = commit.data.author; | ||
const repoUrl = `https://github.com/${process.env.GITHUB_REPOSITORY}`; | ||
const shortSha = process.env.GITHUB_SHA?.substr(0, 7); | ||
const runLink = `${repoUrl}/actions/runs/${process.env.GITHUB_RUN_ID}`; | ||
const webhookBody = new WebhookBody(); | ||
|
||
// Set status and elapsedSeconds | ||
let labels = `\`${status.toUpperCase()}\``; | ||
if (elapsedSeconds) { | ||
labels = `\`${status.toUpperCase()} [${elapsedSeconds}s]\``; | ||
} | ||
|
||
// Set environment name | ||
const environment = getInput("environment"); | ||
if (environment) { | ||
labels += ` \`ENV:${environment.toUpperCase()}\``; | ||
} | ||
|
||
// Set themeColor | ||
webhookBody.themeColor = CONCLUSION_THEMES[status] || "957DAD"; | ||
|
||
webhookBody.text = | ||
`${labels} CI [#${process.env.GITHUB_RUN_NUMBER}](${runLink}) ` + | ||
`(commit [${shortSha}](${commit.data.html_url})) on [${process.env.GITHUB_REPOSITORY}](${repoUrl}) ` + | ||
`by [@${author.login}](${author.html_url})`; | ||
return webhookBody; | ||
} |
Oops, something went wrong.