From f3fd13a6077e641b20b3ba3044b8c33c3e6fffd2 Mon Sep 17 00:00:00 2001 From: Logan Drescher Date: Fri, 31 Jan 2025 10:53:20 -0500 Subject: [PATCH] Attempting to fix "no text" error --- .github/workflows/NightlyBMDB_CLI.yml | 2 +- .github/workflows/NightlyPublished_CLI.yml | 26 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/NightlyBMDB_CLI.yml b/.github/workflows/NightlyBMDB_CLI.yml index 8954c83780..fa54861012 100644 --- a/.github/workflows/NightlyBMDB_CLI.yml +++ b/.github/workflows/NightlyBMDB_CLI.yml @@ -376,7 +376,7 @@ jobs: path: ${{ github.workspace }}/tracer.json - name: Post results to slack part 1 (report.md from exec-report CLI command) - run: curl -X POST -F token="${{ secrets.SLACK_BOT_TOKEN }}" -F channel=${{ secrets.SLACK_CHANNEL_VCELL_DEV_TOKEN }} -F text="```$(cat ${GITHUB_WORKSPACE}/report.md)```" https://slack.com/api/chat.postMessage + run: curl -X POST -F token="${{ secrets.SLACK_BOT_TOKEN }}" -F channel=${{ secrets.SLACK_CHANNEL_VCELL_DEV_TOKEN }} -F text="BMDB Results:\n\`\`\`$(cat ${GITHUB_WORKSPACE}/report.md)\`\`\`" https://slack.com/api/chat.postMessage # Not currently working - name: Post results to slack part 2 (sound alarm if changed results) diff --git a/.github/workflows/NightlyPublished_CLI.yml b/.github/workflows/NightlyPublished_CLI.yml index e7c20b56f1..071958b6b9 100644 --- a/.github/workflows/NightlyPublished_CLI.yml +++ b/.github/workflows/NightlyPublished_CLI.yml @@ -375,8 +375,32 @@ jobs: - name: Show results) run: echo "$(cat ${GITHUB_WORKSPACE}/report.md)" + - name: Read report file into GH env variable + run: echo "REPORT_CONTENT<> $GITHUB_ENV && cat ${{ github.workspace }}/report.md >> $GITHUB_ENV && echo "EOF" >> $GITHUB_ENV + - name: Post results to slack part 1 (report.md from exec-report CLI command) - run: curl -X POST -F token="${{ secrets.SLACK_BOT_TOKEN }}" -F channel=${{ secrets.SLACK_CHANNEL_VCELL_DEV_TOKEN }} -F text="```$(cat ${GITHUB_WORKSPACE}/report.md)```" https://slack.com/api/chat.postMessage + run: | + if [[ "$(cat ${GITHUB_WORKSPACE}/report.md) | wc -c | awk '{ print $1; }'" -lt "2970" ]]; then + curl -X POST -H "Authorization: Bearer ${{ secrets.SLACK_BOT_TOKEN }}" -H "Content-type: application/json" \ + --data '{ + "channel": "${{ secrets.SLACK_CHANNEL_VCELL_DEV_TOKEN }}", + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "```\nPublished Results:\n${{ env.REPORT_CONTENT }}\n```" + } + } + ] + }' https://slack.com/api/chat.postMessage + else + # Results too long to be formatted + echo "Results too long to format with code block" + curl -X POST -F token="${{ secrets.SLACK_BOT_TOKEN }}" -F channel=${{ secrets.SLACK_CHANNEL_VCELL_DEV_TOKEN }} -F text="$(cat ${GITHUB_WORKSPACE}/report.md)" https://slack.com/api/chat.postMessage + fi + + # Not currently working - name: Post results to slack part 2 (sound alarm if changed results)