From 817563d50898a1b754cc581c67ce850b243e8fe0 Mon Sep 17 00:00:00 2001 From: samuelarogbonlo Date: Thu, 16 Nov 2023 14:17:31 +0100 Subject: [PATCH] add slack token env and also make slack channel configurable Signed-off-by: samuelarogbonlo --- .github/workflows/mirror-builtin-actors.yml | 13 +++++++------ scripts/mirror-builtin-actors.sh | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/mirror-builtin-actors.yml b/.github/workflows/mirror-builtin-actors.yml index 414ceb623..adefaee5a 100644 --- a/.github/workflows/mirror-builtin-actors.yml +++ b/.github/workflows/mirror-builtin-actors.yml @@ -1,16 +1,11 @@ name: Mirror Builtin Actors Releases - on: # schedule: # - cron: '0 * * * *' # Runs every hour pull_request: - branches: - - main paths: - 'script/mirror-builtin-actors.sh' push: - branches: - - main paths: - 'script/mirror-builtin-actors.sh' workflow_dispatch: @@ -33,6 +28,9 @@ jobs: working-directory: script if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') run: bash ./mirror-builtin-actors.sh filecoin-builtin-actors/actors + env: + SLACK_API_TOKEN: ${{ secrets.SLACK_TOKEN }} + mirror-releases-cf: needs: mirror-releases-do @@ -47,9 +45,12 @@ jobs: provider: cloudflare access_key: ${{ secrets.R2_ACCESS_KEY }} secret_key: ${{ secrets.R2_SECRET_KEY }} - account_id: 2238a825c5aca59233eab1f221f7aefb + account_id: "2238a825c5aca59233eab1f221f7aefb" - name: Run mirroring script to Cloudflare working-directory: script if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') run: bash ./mirror-builtin-actors.sh filecoin-builtin-actors/actors + env: + SLACK_API_TOKEN: ${{ secrets.SLACK_TOKEN }} + SLACK_CHANNEL: "#forest-dump" diff --git a/scripts/mirror-builtin-actors.sh b/scripts/mirror-builtin-actors.sh index 4f62114ca..be9063501 100755 --- a/scripts/mirror-builtin-actors.sh +++ b/scripts/mirror-builtin-actors.sh @@ -51,7 +51,7 @@ send_slack_alert_with_summary() { local message="Builtin-actors assets upload summary:\n✅ Successful: $success_list\n🔥 Failed: $failure_list" curl -X POST -H 'Content-type: application/json' -H "Authorization: Bearer $SLACK_API_TOKEN" \ - --data "{\"channel\":\"#forest-dump\",\"text\":\"${message}\"}" \ + --data "{\"channel\":\"#SLACK_CHANNEL\",\"text\":\"${message}\"}" \ https://slack.com/api/chat.postMessage }