Relay Balances Slack Report #197
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Relay Balances Slack Report | |
| on: | |
| schedule: | |
| # Every day at 11:53 and 23:53 UTC | |
| - cron: '53 11,23 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| relay-balances-slack-report: | |
| name: Relay balances by chainId | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| - name: Generate Slack payload | |
| id: payload | |
| env: | |
| RELAY_ALERT_USD_THRESHOLD: '${{ vars.RELAY_ALERT_USD_THRESHOLD }}' | |
| RELAY_APP_FEES_ADDRESS: '${{ vars.RELAY_APP_FEES_ADDRESS }}' | |
| run: | | |
| set -euo pipefail | |
| node .github/scripts/post-relay-subsidy-balance.mjs > payload.json | |
| # Fail early with a clear error if the payload isn't valid JSON. | |
| node -e 'JSON.parse(require("fs").readFileSync(process.argv[1], "utf8"))' payload.json | |
| PAYLOAD="$(< payload.json)" | |
| if [[ -z "${PAYLOAD//[[:space:]]/}" ]]; then | |
| echo "Generated Slack payload is empty." >&2 | |
| exit 1 | |
| fi | |
| { | |
| echo "payload<<EOF" | |
| printf '%s\n' "$PAYLOAD" | |
| echo "EOF" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Send Slack notification | |
| uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 | |
| with: | |
| webhook: '${{ secrets.SLACK_RELAY_SUBSIDY_BALANCE_TRACKER_WEBHOOK_URL }}' | |
| webhook-type: incoming-webhook | |
| payload: ${{ steps.payload.outputs.payload }} |