File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed
Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Regtest Mine Blocks
2+
3+ on :
4+ schedule :
5+ - cron : ' 0 2 * * *' # 2 AM UTC daily
6+ workflow_dispatch :
7+ inputs :
8+ blocktank_server :
9+ description : Blocktank base URL
10+ required : true
11+ default : ' https://api.stag0.blocktank.to/blocktank/api/v2'
12+ block_count :
13+ description : Number of regtest blocks to mine
14+ required : true
15+ default : ' 1'
16+
17+ jobs :
18+ mine :
19+ runs-on : ubuntu-latest
20+ env :
21+ BLOCK_COUNT : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.block_count || '1' }}
22+ BLOCKTANK_SERVER : ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.blocktank_server || 'https://api.stag0.blocktank.to/blocktank/api/v2' }}
23+ steps :
24+ - name : Validate params
25+ run : |
26+ if [[ -z "${BLOCK_COUNT}" ]]; then
27+ echo "BLOCK_COUNT is empty" >&2
28+ exit 1
29+ fi
30+ if ! [[ "${BLOCK_COUNT}" =~ ^[0-9]+$ ]]; then
31+ echo "BLOCK_COUNT must be a positive integer: ${BLOCK_COUNT}" >&2
32+ exit 1
33+ fi
34+ if [[ "${BLOCK_COUNT}" -eq 0 ]]; then
35+ echo "BLOCK_COUNT must be greater than zero" >&2
36+ exit 1
37+ fi
38+ if [[ -z "${BLOCKTANK_SERVER}" ]]; then
39+ echo "BLOCKTANK_SERVER is empty" >&2
40+ exit 1
41+ fi
42+ - name : Mine regtest blocks
43+ run : |
44+ echo "Mining ${BLOCK_COUNT} block(s) on regtest..."
45+ curl --fail --silent --show-error \
46+ -X POST \
47+ "${BLOCKTANK_SERVER}/regtest/chain/mine" \
48+ -H 'Content-Type: application/json' \
49+ -d "{\"count\": ${BLOCK_COUNT}}"
You can’t perform that action at this time.
0 commit comments