Skip to content

Commit 61806de

Browse files
committed
Regtest mine workflow
1 parent e3f4cdc commit 61806de

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/regtest-mine.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Regtest Mine Blocks
2+
3+
on:
4+
schedule:
5+
- cron: '0 2 * * *' # 2 AM UTC daily
6+
workflow_dispatch:
7+
inputs:
8+
block_count:
9+
description: Number of regtest blocks to mine
10+
required: true
11+
default: '1'
12+
13+
jobs:
14+
mine:
15+
runs-on: ubuntu-latest
16+
env:
17+
BLOCK_COUNT: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.block_count || '1' }}
18+
steps:
19+
- name: Validate block count
20+
run: |
21+
if [[ -z "${BLOCK_COUNT}" ]]; then
22+
echo "BLOCK_COUNT is empty" >&2
23+
exit 1
24+
fi
25+
if ! [[ "${BLOCK_COUNT}" =~ ^[0-9]+$ ]]; then
26+
echo "BLOCK_COUNT must be a positive integer: ${BLOCK_COUNT}" >&2
27+
exit 1
28+
fi
29+
if [[ "${BLOCK_COUNT}" -eq 0 ]]; then
30+
echo "BLOCK_COUNT must be greater than zero" >&2
31+
exit 1
32+
fi
33+
- name: Mine regtest blocks
34+
run: |
35+
echo "Mining ${BLOCK_COUNT} block(s) on regtest…"
36+
curl --fail --silent --show-error \
37+
-X POST \
38+
https://api.stag0.blocktank.to/blocktank/api/v2/regtest/chain/mine \
39+
-H 'Content-Type: application/json' \
40+
-d "{\"count\": ${BLOCK_COUNT}}"

0 commit comments

Comments
 (0)