ci: rewrite Github Actions slack error reporting (#28904)

This commit is contained in:
Yihau Chen 2022-11-21 19:22:00 +08:00 committed by GitHub
parent 6dc7cd0845
commit 4c2733485a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 72 additions and 49 deletions

View File

@ -41,16 +41,6 @@ jobs:
- name: Stable build - name: Stable build
run: ./cargo stable ndk --target ${{ matrix.target }} build -p solana-client run: ./cargo stable ndk --target ${{ matrix.target }} build -p solana-client
- name: Send Slack notifiaction
if: failure()
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
with:
channel: ${{ secrets.SLACK_CHANNEL }}
status: FAILED
color: danger
ios: ios:
strategy: strategy:
matrix: matrix:
@ -73,12 +63,23 @@ jobs:
- name: Stable build - name: Stable build
run: ./cargo stable build --target ${{ matrix.target }} -p solana-client run: ./cargo stable build --target ${{ matrix.target }} -p solana-client
- name: Send Slack notifiaction error_reporting:
if: failure() needs:
env: - android
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }} - ios
uses: voxmedia/github-action-slack-notify-build@v1 if: failure() && github.event_name == 'push'
with: runs-on: ubuntu-20.04
channel: ${{ secrets.SLACK_CHANNEL }} steps:
status: FAILED - name: Slack
color: danger run: |
curl -H "Content-Type: application/json" \
-X POST ${{ secrets.SLACK_ERROR_REPORTING_WEBHOOK }} \
-d '{
"attachments": [
{
"color": "#AC514C",
"text":
"*${{ github.repository }} (${{ github.workflow }})*\n${{ github.event.head_commit.message }} - _${{ github.event.head_commit.author.name }}_\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Build>",
}
]
}'

View File

@ -88,18 +88,23 @@ jobs:
env: env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
notification: error_reporting:
if: failure()
runs-on: ubuntu-20.04
needs: needs:
- check - check
- build_and_deploy - build_and_deploy
if: failure() && github.event_name == 'push'
runs-on: ubuntu-20.04
steps: steps:
- name: Send Slack notifiaction - name: Slack
env: run: |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }} curl -H "Content-Type: application/json" \
uses: voxmedia/github-action-slack-notify-build@v1 -X POST ${{ secrets.SLACK_ERROR_REPORTING_WEBHOOK }} \
with: -d '{
channel: ${{ secrets.SLACK_CHANNEL }} "attachments": [
status: FAILED {
color: danger "color": "#AC514C",
"text":
"*${{ github.repository }} (${{ github.workflow }})*\n${{ github.event.head_commit.message }} - _${{ github.event.head_commit.author.name }}_\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Build>",
}
]
}'

View File

@ -25,12 +25,23 @@ jobs:
chmod +x ./ci/export-github-repo.sh chmod +x ./ci/export-github-repo.sh
./ci/export-github-repo.sh web3.js/ solana-web3.js ./ci/export-github-repo.sh web3.js/ solana-web3.js
shell: bash shell: bash
- name: Send Slack notifiaction
if: failure() error_reporting:
env: needs:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }} - web3
uses: voxmedia/github-action-slack-notify-build@v1 if: failure() && github.event_name == 'push'
with: runs-on: ubuntu-20.04
channel: ${{ secrets.SLACK_CHANNEL }} steps:
status: FAILED - name: Slack
color: danger run: |
curl -H "Content-Type: application/json" \
-X POST ${{ secrets.SLACK_ERROR_REPORTING_WEBHOOK }} \
-d '{
"attachments": [
{
"color": "#AC514C",
"text":
"*${{ github.repository }} (${{ github.workflow }})*\n${{ github.event.head_commit.message }} - _${{ github.event.head_commit.author.name }}_\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Build>",
}
]
}'

View File

@ -18,16 +18,22 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
send-slack-notification: error_reporting:
runs-on: ubuntu-20.04
needs: needs:
- release-artifacts - release-artifacts
if: failure() if: failure() && github.event_name == 'push'
runs-on: ubuntu-20.04
steps: steps:
- env: - name: Slack
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }} run: |
uses: voxmedia/github-action-slack-notify-build@v1 curl -H "Content-Type: application/json" \
with: -X POST ${{ secrets.SLACK_ERROR_REPORTING_WEBHOOK }} \
channel: ${{ secrets.SLACK_CHANNEL }} -d '{
status: FAILED "attachments": [
color: danger {
"color": "#AC514C",
"text":
"*${{ github.repository }} (${{ github.workflow }})*\n${{ github.event.head_commit.message }} - _${{ github.event.head_commit.author.name }}_\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Build>",
}
]
}'