From f568d1bf58431547b2f23c31f337a2f310c8922c Mon Sep 17 00:00:00 2001 From: ryoya ito Date: Sun, 17 May 2020 22:49:02 +0900 Subject: [PATCH] refactor --- .github/workflows/test.yml | 2 +- src/env_variables.ts | 4 ++-- src/main.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1c6671f..d00a339 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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>' diff --git a/src/env_variables.ts b/src/env_variables.ts index b2ecd29..1be0935 100644 --- a/src/env_variables.ts +++ b/src/env_variables.ts @@ -6,7 +6,7 @@ interface GitHubEnvVariables { interface ProcessEnvVariables { webhookURL: string - slackUser?: string + slackGithubPairs?: string slackIconURL?: string slackUsername?: string attachmentsTitle?: string @@ -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 ?? '', diff --git a/src/main.ts b/src/main.ts index 2e8e456..a76c402 100644 --- a/src/main.ts +++ b/src/main.ts @@ -12,11 +12,11 @@ async function run(): Promise { 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)