Skip to content

Commit

Permalink
have a name of the application derived from workflow name
Browse files Browse the repository at this point in the history
  • Loading branch information
chaporgin committed Mar 13, 2024
1 parent f487746 commit 90e6a85
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/notification_helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,15 @@ const getCommitEmbeds: (w: any) => Block|KnownBlock = (

const getWorkflowEnv = (workflow_run: any) => {
if (isConsoleRepo(workflow_run)) {
if (workflow_run.head_branch == process.env.CONSOLE_STAGING_BRANCH_NAME) {
return "*[ STAGING CONSOLE ]*";
}
if (workflow_run.head_branch == process.env.CONSOLE_PRODUCTION_BRANCH_NAME) {
return "*[ PRODUCTION CONSOLE ]*";
}
const envName =
workflow_run.head_branch === process.env.CONSOLE_PRODUCTION_BRANCH_NAME
? 'PRODUCTION' : 'STAGING';
// expect workflow_run.workflow == "./something/controlplane.yml"
// and produce "CONTROLPLANE"
const words = workflow_run.workflow.split('.')
const appName = words[words.length - 2].toUpperCase()

return `*[ ${envName} ${appName} ]*`;
} else if (isNeonRepo(workflow_run)) {
if (workflow_run.head_branch == process.env.NEON_STAGING_BRANCH_NAME) {
return "*[ STAGING NEON ]*";
Expand Down

0 comments on commit 90e6a85

Please sign in to comment.