Skip to content

Commit

Permalink
배포완료공지
Browse files Browse the repository at this point in the history
  • Loading branch information
jaehwang2 committed Dec 12, 2022
1 parent 744e312 commit bd543ab
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
14 changes: 9 additions & 5 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ async function run(): Promise<void> {
const slackReceiverTeam: string = core.getInput('slack-receiver-group', {
required: false
})
const completionNotification: boolean = core.getBooleanInput(
'completion-notification',
{
required: true
}
)

core.debug(`Deploy Notification To Slack version: ${version}`)

Expand All @@ -19,7 +25,8 @@ async function run(): Promise<void> {
milestoneIssues,
version,
slackReceiverUser,
slackReceiverTeam
slackReceiverTeam,
completionNotification
)
} catch (error) {
if (error instanceof Error) core.setFailed(error.message)
Expand Down
17 changes: 14 additions & 3 deletions src/slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as core from '@actions/core'
function getPayload(
issues: Issue[],
version: string,
completionNotification: boolean,
slackReceiverUser?: string,
slackReceiverTeam?: string
): any {
Expand All @@ -27,6 +28,9 @@ function getPayload(
.map(target => `<!subteam^${target}>`)
.join(' ')
: ' '
const notificationTitle = completionNotification
? '[리얼 배포 완료 공지]'
: '[리얼 배포 예정 안내]'

const payload = {
text: 'anouncement',
Expand All @@ -35,7 +39,7 @@ function getPayload(
type: 'section',
text: {
type: 'plain_text',
text: '[배포 예정 안내]'
text: `${notificationTitle}`
}
},
{
Expand Down Expand Up @@ -77,7 +81,8 @@ export async function sendToSlack(
issues: Issue[],
version: string,
slackReceiverUser?: string,
slackReceiverTeam?: string
slackReceiverTeam?: string,
completionNotification: boolean = false
): Promise<void> {
core.debug(`send slack notification: ${version}`)
await fetch(getSlackUrl(), {
Expand All @@ -86,7 +91,13 @@ export async function sendToSlack(
Accept: 'application/json'
},
body: JSON.stringify(
getPayload(issues, version, slackReceiverUser, slackReceiverTeam)
getPayload(
issues,
version,
completionNotification,
slackReceiverUser,
slackReceiverTeam
)
)
})
}

0 comments on commit bd543ab

Please sign in to comment.