From a3d4b992c1c88ff899b2057345853208f6ff86a0 Mon Sep 17 00:00:00 2001 From: Tina-57blocks Date: Wed, 17 Jul 2024 10:24:55 +0800 Subject: [PATCH 1/2] update slack notification --- .github/workflows/ci.yml | 44 +++++++++++++-------------------- .github/workflows/prod-test.yml | 44 +++++++++++++-------------------- 2 files changed, 34 insertions(+), 54 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e6521ba..c12e374 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,35 +50,25 @@ jobs: echo API_KEY=${{ secrets.API_KEY }} >> .env test_env=sepolia npx playwright test + - name: Deploy report to GitHub Pages + if: always() + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./playwright-report-sepolia + publish_branch: gh-pages + keep_files: true + - name: Push Slack Notification - uses: slackapi/slack-github-action@v1.25.0 + uses: storyprotocol/gha-workflows/.github/workflows/reusable-slack-notifs.yml@main with: - channel-id: ${{ secrets.SLACK_CHANNEL_ID_API_INTEGRATION_TESTS }} - payload: | - { - "text": "${{ github.repository }}: API Integration Tests have been completed. Check the results at github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", - "blocks": [ - { "type": "divider" }, - { - "type": "image", - "title": { - "type": "plain_text", - "text": "Playwright Test Results" - }, - "image_url": "http://www.quickmeme.com/img/b9/b9848df257b95cd39585368475a4b4e4a3a8c774f7390226daecb79b912087ad.jpg", - "alt_text": "Playwright Test Results" - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text":"${{ github.repository }}: API Integration Tests have been completed. \nCheck the results at https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" - } - } - ] - } - env: - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + short-desc: "${{ github.repository }}: API Integration Tests have been completed. Check the results at https://storyprotocol.github.io/api-integration-tests/index.html" + title: "API Integration Test Results" + img-url: "http://www.quickmeme.com/img/b9/b9848df257b95cd39585368475a4b4e4a3a8c774f7390226daecb79b912087ad.jpg" + img-alt-text: "API Integration Test Results" + secrets: + channel-name: ${{ secrets.SLACK_CHANNEL_ID_API_INTEGRATION_TESTS }} + slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} - name: Upload Test Results uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 diff --git a/.github/workflows/prod-test.yml b/.github/workflows/prod-test.yml index 565075f..a8f5b90 100644 --- a/.github/workflows/prod-test.yml +++ b/.github/workflows/prod-test.yml @@ -39,35 +39,25 @@ jobs: echo API_KEY=${{ secrets.API_KEY_PROD }} >> .env test_env=sepolia npx playwright test + - name: Deploy report to GitHub Pages + if: always() + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./playwright-report-sepolia + publish_branch: gh-pages + keep_files: true + - name: Push Slack Notification - uses: slackapi/slack-github-action@v1.25.0 + uses: storyprotocol/gha-workflows/.github/workflows/reusable-slack-notifs.yml@main with: - channel-id: ${{ secrets.SLACK_CHANNEL_ID_API_INTEGRATION_TESTS }} - payload: | - { - "text": "${{ github.repository }}: API Testing for Prod Endpoint have been completed. Check the results at github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", - "blocks": [ - { "type": "divider" }, - { - "type": "image", - "title": { - "type": "plain_text", - "text": "Playwright Test Results" - }, - "image_url": "http://www.quickmeme.com/img/b9/b9848df257b95cd39585368475a4b4e4a3a8c774f7390226daecb79b912087ad.jpg", - "alt_text": "Playwright Test Results" - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text":"${{ github.repository }}: API Testing for Prod Endpoint have been completed. \nCheck the results at https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" - } - } - ] - } - env: - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + short-desc: "${{ github.repository }}: API Integration Tests of Prod have been completed. Check the results at https://storyprotocol.github.io/api-integration-tests/index.html" + title: "API Integration Test Results of Prod" + img-url: "http://www.quickmeme.com/img/b9/b9848df257b95cd39585368475a4b4e4a3a8c774f7390226daecb79b912087ad.jpg" + img-alt-text: "API Integration Test Results" + secrets: + channel-name: ${{ secrets.SLACK_CHANNEL_ID_API_INTEGRATION_TESTS }} + slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} - name: Upload Test Results uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 From 2fcf2cf25d06fa0e65399a148e1f71efa2f590f7 Mon Sep 17 00:00:00 2001 From: Tina-57blocks Date: Wed, 17 Jul 2024 10:36:51 +0800 Subject: [PATCH 2/2] update workflows --- .github/workflows/ci.yml | 23 ++++++++++++----------- .github/workflows/prod-test.yml | 24 +++++++++++++----------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c12e374..4d72a4d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,17 +59,6 @@ jobs: publish_branch: gh-pages keep_files: true - - name: Push Slack Notification - uses: storyprotocol/gha-workflows/.github/workflows/reusable-slack-notifs.yml@main - with: - short-desc: "${{ github.repository }}: API Integration Tests have been completed. Check the results at https://storyprotocol.github.io/api-integration-tests/index.html" - title: "API Integration Test Results" - img-url: "http://www.quickmeme.com/img/b9/b9848df257b95cd39585368475a4b4e4a3a8c774f7390226daecb79b912087ad.jpg" - img-alt-text: "API Integration Test Results" - secrets: - channel-name: ${{ secrets.SLACK_CHANNEL_ID_API_INTEGRATION_TESTS }} - slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} - - name: Upload Test Results uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 # if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/main' @@ -77,3 +66,15 @@ jobs: name: sepolia-test-reports path: | ./playwright-report-sepolia/index.html + + push-slack-notification: + name: Push Slack Notification + uses: storyprotocol/gha-workflows/.github/workflows/reusable-slack-notifs.yml@main + with: + short-desc: "${{ github.repository }}: API Integration Tests have been completed. Check the results at https://storyprotocol.github.io/api-integration-tests/index.html" + title: "API Integration Test Results" + img-url: "http://www.quickmeme.com/img/b9/b9848df257b95cd39585368475a4b4e4a3a8c774f7390226daecb79b912087ad.jpg" + img-alt-text: "API Integration Test Results" + secrets: + channel-name: ${{ secrets.SLACK_CHANNEL_ID_API_INTEGRATION_TESTS }} + slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/prod-test.yml b/.github/workflows/prod-test.yml index a8f5b90..bed16c8 100644 --- a/.github/workflows/prod-test.yml +++ b/.github/workflows/prod-test.yml @@ -48,20 +48,22 @@ jobs: publish_branch: gh-pages keep_files: true - - name: Push Slack Notification - uses: storyprotocol/gha-workflows/.github/workflows/reusable-slack-notifs.yml@main - with: - short-desc: "${{ github.repository }}: API Integration Tests of Prod have been completed. Check the results at https://storyprotocol.github.io/api-integration-tests/index.html" - title: "API Integration Test Results of Prod" - img-url: "http://www.quickmeme.com/img/b9/b9848df257b95cd39585368475a4b4e4a3a8c774f7390226daecb79b912087ad.jpg" - img-alt-text: "API Integration Test Results" - secrets: - channel-name: ${{ secrets.SLACK_CHANNEL_ID_API_INTEGRATION_TESTS }} - slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} - - name: Upload Test Results uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 + # if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/main' with: name: sepolia-test-reports path: | ./playwright-report-sepolia/index.html + + push-slack-notification: + name: Push Slack Notification + uses: storyprotocol/gha-workflows/.github/workflows/reusable-slack-notifs.yml@main + with: + short-desc: "${{ github.repository }}: API Integration Tests of Prod have been completed. Check the results at https://storyprotocol.github.io/api-integration-tests/index.html" + title: "API Integration Test Results of Prod" + img-url: "http://www.quickmeme.com/img/b9/b9848df257b95cd39585368475a4b4e4a3a8c774f7390226daecb79b912087ad.jpg" + img-alt-text: "API Integration Test Results" + secrets: + channel-name: ${{ secrets.SLACK_CHANNEL_ID_API_INTEGRATION_TESTS }} + slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} \ No newline at end of file