From ed17e3a5936e1af961a59a27c9b39b98698bcbed Mon Sep 17 00:00:00 2001 From: Gautam Botrel Date: Fri, 13 Sep 2024 16:30:10 -0500 Subject: [PATCH] build: ci test --- .github/workflows/pr.yml | 1 - .github/workflows/push.yml | 7 +++---- .github/workflows/slack-notifications.yml | 8 ++------ 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 3c3b9e31e..7ee179c6f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -97,7 +97,6 @@ jobs: status: ${{ needs.test.result }} actor: ${{ github.actor }} repository: ${{ github.repository }} - pr_title: ${{ github.event.pull_request.title }} branch: ${{ github.event.pull_request.head.ref }} run_id: ${{ github.run_id }} failures: ${{ needs.test.outputs.failures }} \ No newline at end of file diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index f3aa9b3ca..834d27b56 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -87,14 +87,13 @@ jobs: slack-notifications: if: always() - needs: - - staticcheck - - test uses: ./.github/workflows/slack-notifications.yml + secrets: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} with: status: ${{ needs.test.result }} actor: ${{ github.actor }} repository: ${{ github.repository }} - branch: ${{ github.ref_name }} + branch: ${{ github.event.pull_request.head.ref }} run_id: ${{ github.run_id }} failures: ${{ needs.test.outputs.failures }} \ No newline at end of file diff --git a/.github/workflows/slack-notifications.yml b/.github/workflows/slack-notifications.yml index 564e03a07..1fb7885cf 100644 --- a/.github/workflows/slack-notifications.yml +++ b/.github/workflows/slack-notifications.yml @@ -19,10 +19,6 @@ on: description: 'The GitHub repository' required: true type: string - pr_title: - description: 'Pull request title' - required: false - type: string branch: description: 'The branch name' required: true @@ -43,9 +39,9 @@ jobs: - name: Post to Slack run: | if [ "${{ inputs.status }}" == "success" ]; then - payload="{\"channel\":\"team-gnark-build\",\"text\":\"GitHub Action build result: success\",\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\":white_check_mark: *Workflow Succeeded*\"}},{\"type\":\"section\",\"fields\":[{\"type\":\"mrkdwn\",\"text\":\"*Actor:*\n${{ inputs.actor }}\"},{\"type\":\"mrkdwn\",\"text\":\"*Repository:*\n${{ inputs.repository }}\"},{\"type\":\"mrkdwn\",\"text\":\"*PR Title:*\n${{ inputs.pr_title }}\"},{\"type\":\"mrkdwn\",\"text\":\"*Branch:*\n${{ inputs.branch }}\"}]},{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"*View Run:* \"}}]}" + payload="{\"channel\":\"team-gnark-build\",\"text\":\"GitHub Action build result: success\",\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\":white_check_mark: ${{ inputs.repository }} *${{ inputs.branch }}*\"}},{\"type\":\"context\",\"elements\":[{\"type\":\"plain_text\",\"text\":\"Author: ${{ inputs.actor }}\",\"emoji\":true}]}]}" else - payload="{\"channel\":\"team-gnark-build\",\"text\":\"GitHub Action build result: failure\",\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\":red_circle: @${{ inputs.actor }} *${{ inputs.repository }}*\"}},{\"type\":\"section\",\"fields\":[{\"type\":\"mrkdwn\",\"text\":\"*PR:*\n${{ inputs.pr_title }}\"},{\"type\":\"mrkdwn\",\"text\":\"*Branch:*\n${{ inputs.branch }}\"}]},{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"*Failed Step:* \"}},{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"*Test Failure Details:* \n${{ inputs.failures }}\"}}]}" + payload="{\"channel\":\"team-gnark-build\",\"text\":\"GitHub Action build result: failure\",\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\":red_circle: ${{ inputs.repository }} *${{ inputs.branch }}*\"}},{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"*Failed Step:* \"}},{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"*Test Failure Details:* ${{ inputs.failures }}\"}},{\"type\":\"context\",\"elements\":[{\"type\":\"plain_text\",\"text\":\"Author: ${{ inputs.actor }}\",\"emoji\":true}]}]}" fi curl -X POST -H 'Content-type: application/json; charset=utf-8' --data "$payload" https://slack.com/api/chat.postMessage -H "Authorization: Bearer ${{ secrets.SLACK_BOT_TOKEN }}" shell: bash \ No newline at end of file