Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ry-itto committed May 17, 2020
1 parent 4901c9b commit f568d1b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_ICON_URL: 'https://github.com/ry-itto.png'
SLACK_USERNAME: 'Capicapi'
SLACK_USER: ${{ secrets.SLACK_USER }}
GITHUB_SLACK_USER_PAIRS: ${{ secrets.SLACK_USER }}
TITLE: ':tada: Success :tada:'
BODY: '<@ry-itto>'

4 changes: 2 additions & 2 deletions src/env_variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface GitHubEnvVariables {

interface ProcessEnvVariables {
webhookURL: string
slackUser?: string
slackGithubPairs?: string
slackIconURL?: string
slackUsername?: string
attachmentsTitle?: string
Expand Down Expand Up @@ -42,7 +42,7 @@ export const readEnvVariables = (): EnvVariables => {
githubRef,
githubEvent,
slackIconURL: process.env.SLACK_ICON_URL,
slackUser: process.env.SLACK_USER,
slackGithubPairs: process.env.SLACK_GITHUB_USER_PAIRS,
slackUsername: process.env.SLACK_USERNAME,
attachmentsTitle: process.env.TITLE ?? '',
attachmentsTitleURL: process.env.TITLE_URL ?? '',
Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ async function run(): Promise<void> {
const envVariables = readEnvVariables()
const title = replaceGitHubUsernameWithSlackUsername(
envVariables.attachmentsTitle ?? '',
envVariables.slackUser ?? ''
envVariables.slackGithubPairs ?? ''
)
const body = replaceGitHubUsernameWithSlackUsername(
envVariables.attachmentsBody ?? '',
envVariables.slackUser ?? ''
envVariables.slackGithubPairs ?? ''
)

const webhook = new slack.IncomingWebhook(envVariables.webhookURL)
Expand Down

0 comments on commit f568d1b

Please sign in to comment.