CronJob - Prize Claimer Bot - Arbitrum #25964
This file contains 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: CronJob - Prize Claimer Bot - Arbitrum | |
on: | |
schedule: | |
- cron: "*/5 * * * *" # ie. 4:05pm, 4:10pm, 4:15pm ... etc. | |
push: | |
env: | |
CHAIN_ID: 42161 | |
MIN_PROFIT_THRESHOLD_USD: 0.1 | |
REWARD_RECIPIENT: '' | |
JSON_RPC_URL: ${{ secrets.ARBITRUM_MAINNET_JSON_RPC_URL }} | |
COVALENT_API_KEY: ${{ secrets.COVALENT_API_KEY }} | |
CUSTOM_RELAYER_PRIVATE_KEY: ${{ secrets.CUSTOM_RELAYER_PRIVATE_KEY }} | |
CONTRACT_JSON_URL: 'https://raw.githubusercontent.com/GenerationSoftware/pt-v5-mainnet/bc9e4b4c25a033ec3c1c2b89b62422399b7db2f6/deployments/arbitrum/contracts.json' | |
SUBGRAPH_URL: 'https://api.studio.thegraph.com/query/63100/pt-v5-arbitrum/version/latest?source=pooltogether' | |
NODE_OPTIONS: "--max_old_space_size=32768" | |
permissions: write-all | |
jobs: | |
runCLI: | |
name: Prize Claimer Bot | |
runs-on: ${{ matrix.os }} | |
strategy: | |
max-parallel: 1 | |
matrix: | |
node: ["20.11.1"] | |
os: [ubuntu-latest] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Use Node ${{ matrix.node }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: Store current date | |
id: date | |
run: echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_ENV" | |
- name: Store current time | |
id: time | |
run: echo "time=$(date +'%H-%M-%S_%Z')" >> "$GITHUB_ENV" | |
- name: Run bot | |
id: runBot | |
run: | | |
npm install | |
npx tsx index.ts | |
- name: Push changes (if required) | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
force: true | |
- name: Comment Error | |
id: commentError | |
if: steps.runBot.outputs.exitcode == 1 | |
uses: actions/github-script@v5 | |
continue-on-error: true | |
with: | |
script: | | |
await github.rest.issues.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
title: `Prize Claimer bot failed for run at "$date"__"$time": Exit Code 1` | |
}) |