From 7bb3cfdbc31d15b17c4387ea1cb28751b2f7dcdf Mon Sep 17 00:00:00 2001 From: Doeunnkimm Date: Tue, 25 Jun 2024 22:37:41 +0900 Subject: [PATCH] fix --- .github/workflows/slack-notification.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/slack-notification.yml b/.github/workflows/slack-notification.yml index 8f91f846..9606ab27 100644 --- a/.github/workflows/slack-notification.yml +++ b/.github/workflows/slack-notification.yml @@ -23,8 +23,9 @@ jobs: - name: Read user mapping from JSON id: read_user_mapping run: | - mapping=$(cat .github/user-mapping.json) - echo "mapping=$mapping" >> $GITHUB_ENV + echo "Reading user mapping" + mapping=$(cat .github/user-mapping.json | jq -r 'to_entries|map("\(.key)=\(.value|tostring)")|.[]') + echo "$mapping" >> $GITHUB_ENV - name: Extract mentions from comment body id: extract_mentions_comment @@ -39,13 +40,13 @@ jobs: run: | mentions="${{ env.mentions }}" slack_mentions="" - while IFS= read -r mention; do + for mention in $mentions; do user=$(echo $mention | sed 's/@//') - slack_user=$(echo ${{ env.mapping }} | jq -r --arg user "$user" '.[$user]') + slack_user=$(eval echo \${$user}) if [[ -n "$slack_user" ]]; then slack_mentions="$slack_mentions $slack_user" fi - done <<< "$mentions" + done echo "slack_mentions=$slack_mentions" >> $GITHUB_ENV - name: Determine color for PR creation