-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f04491c
commit 77a2e18
Showing
1 changed file
with
5 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,33 +37,19 @@ jobs: | |
cd backend | ||
./gradlew build | ||
- name: Set up Slack user mapping | ||
id: slack-user-mapping | ||
run: | | ||
EMAIL=$(git log -1 --pretty=format:'%ae') | ||
case "$EMAIL" in | ||
"[email protected]") SLACK_USER_ID="U07AQJWU8S3" ;; # @릴리 | ||
*) SLACK_USER_ID="" ;; | ||
esac | ||
echo "::set-output name=slack_user_id::$SLACK_USER_ID" | ||
- name: Prepare Slack mention | ||
id: prepare-slack-mention | ||
- name: Send Slack notification on failure | ||
if: failure() | ||
run: | | ||
if [ "${{ steps.slack-user-mapping.outputs.slack_user_id }}" != "" ]; then | ||
echo "::set-output name=slack_mention::<@${{ steps.slack-user-mapping.outputs.slack_user_id }}>" | ||
else | ||
echo "::set-output name=slack_mention::" | ||
fi | ||
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/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 | ||
TEXT="<@U012AB3CD>, there was a failure in the CI pipeline for commit $GITHUB_SHA" | ||
curl -X POST -H 'Content-type: application/json' --data '{"text": "'"$TEXT"'"}' $SLACK_WEBHOOK_URL | ||
- name: Send Slack notification | ||
uses: 8398a7/action-slack@v3 | ||
with: | ||
status: ${{ job.status }} | ||
author_name: Github Action Test | ||
fields: repo,pullRequest,eventName,author,message,commit,action,took | ||
mention: '${{ steps.prepare-slack-mention.outputs.slack_mention }}' | ||
if_mention: failure,cancelled | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
if: failure() |