-
Notifications
You must be signed in to change notification settings - Fork 12
63 lines (52 loc) · 1.82 KB
/
fetch-mempool-space.yaml
File metadata and controls
63 lines (52 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: "Fech stale-blocks from mempool-space instances"
on:
workflow_dispatch:
schedule:
- cron: "26 3 * * *"
# Allow creation of PRs
permissions:
contents: write
pull-requests: write
jobs:
fetch-and-pr:
runs-on: ubuntu-slim
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install requests
run: pip install requests
- name: Run ci/fetch-mempool-space.py
run: python3 ci/fetch-mempool-space.py
- name: Check for changes
id: changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "changes=true" >> $GITHUB_OUTPUT
else
echo "changes=false" >> $GITHUB_OUTPUT
fi
- name: Commit changes
if: steps.changes.outputs.changes == 'true'
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
BRANCH="$(date +%Y-%m-%d)-auto-update"
git branch -D $BRANCH || true
git checkout -b $BRANCH
git add stale-blocks.csv
git add blocks/*
git commit -m "automated: add recent stale block(s) $(date +%Y-%m-%d)"
git push origin $BRANCH --force
- name: Create PR
if: steps.changes.outputs.changes == 'true'
run: |
BRANCH="$(date +%Y-%m-%d)-auto-update"
gh pr create \
--title "Automated: add recent stale block(s) $(date +%Y-%m-%d)" \
--body "Adds stale block(s) fetched from mempool-space instances. Please close/reopen or assign/unassign to trigger CI." \
--base master \
--head $BRANCH
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}