Update 1 #190
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
# name: 'Slack Notification' | |
# inputs: | |
# slack_header: # id of input | |
# required: false | |
# default: '' | |
# slack_context: | |
# required: false | |
# default: '' | |
# slack_message_body: | |
# default: '' | |
# required: false | |
# slack_id: | |
# required: true | |
# slack_token: | |
# required: true | |
# runs: | |
# using: "composite" | |
# steps: | |
# - name: Prepare Slack Message | |
# if: ${{ steps.publish.outcome == 'success' && !contains(matrix.package, 'Meta') }} | |
# id: slack-prepare | |
# shell: bash | |
# env: | |
# SLACK_ID: ${{ inputs.slack_id }} | |
# run: | | |
# channel_id=$(echo "$SLACK_ID" | jq -r .\"${{ github.actor }}\") | |
# echo "::add-mask::$channel_id" | |
# echo SLACK_CHANNEL=$channel_id >> $GITHUB_ENV | |
# payload='{"blocks":[]}' | |
# if [[ ${{ inputs.slack_header }} != '']];then | |
# payload=$(echo "$payload" | jq '.blocks += [{"type": "section","text": {"type": "mrkdwn","text": "${{ inputs.slack_header }}"}}]') | |
# fi | |
# if [[ ${{ inputs.slack_message_body }} != '']];then | |
# payload=$(echo "$payload" | jq '.blocks += [{"type": "section","text": {"type": "mrkdwn","text": "${{ inputs.slack_message_body }}"}}]') | |
# fi | |
# if [[ ${{ inputs.slack_context }} != '']];then | |
# payload=$(echo "$payload" | jq '.blocks += [{"type": "context","elements":[{"type": "mrkdwn", "text": "${{ inputs.slack_message_body }}"}]}]') | |
# fi | |
# echo SLACK_PAYLOAD=$payload >> $GITHUB_ENV | |
# header="Package *${{ matrix.package }}* version *${{ matrix.version }}* published to <https://www.npmjs.com/package/$(jq -r .name "packages/${{ matrix.package }}/package.json")/v/${{ matrix.version }}|NPM>" | |
# echo SLACK_MESSAGE_HEADER=${{ inputs.slack_header }} >> $GITHUB_ENV | |
# context="*GitHub Workflow:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} ${{ github.run_number }}>\n*Commit:* <${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|$(echo "${{ github.sha }}" | cut -c1-8) $(echo -e "${{ github.event.head_commit.message }}" | head -n1 | sed -e 's/"/\\"/g')>" | |
# echo SLACK_MESSAGE_CONTEXT=${{ inputs.slack_context }} >> $GITHUB_ENV | |
# - name: Send to Slack | |
# id: slack | |
# if: steps.slack-prepare.outcome == 'success' | |
# uses: slackapi/[email protected] | |
# with: | |
# channel-id: ${{ env.SLACK_CHANNEL }} | |
# payload: ${{ env. SLACK_PAYLOAD }} | |
# env: | |
# SLACK_BOT_TOKEN: ${{ inputs.slack_token }} |