Skip to content

Commit

Permalink
add: action to generate files into separate branch
Browse files Browse the repository at this point in the history
This enables to modify only the dataset and that the generated data-files are always up-to-date.
  • Loading branch information
0xB10C committed Feb 12, 2023
1 parent c943103 commit 1b483c7
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This workflow generates files that can be consumed by downstream tools.

name: generate

env:
FILENAME_POOL_LIST: pool-list.json
FILENAME_POOLS_JSON: pools.json

on:
push:
branches:
- master

jobs:
generate-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
- name: Configure git
run: |
git config --local user.email "[email protected]"
git config --local user.name "bitcoin-data"
- name: Generate files
run: |
python3 contrib/generate-json-pool-list.py new-$FILENAME_POOL_LIST
python3 contrib/generate-old-pools-json.py new-$FILENAME_POOLS_JSON
- name: Checkout 'generated' branch
run:
git checkout generated
- name: Overwrite old files
run: |
mv new-$FILENAME_POOL_LIST $FILENAME_POOL_LIST
mv new-$FILENAME_POOLS_JSON $FILENAME_POOLS_JSON
- name: Commit changes
run: |
git add *.json
git commit -m "Update generated files: $(date)" -a || true
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: generated
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ The JSON files aren't intended for direct consumption by tools trying to
identify mining pools. The format may change. Rather, the data in the
JSON-files should be used to generate a file suitable for consumption by
down-stream tools. An example is the `contrib/generate-old-pools-json.py`
script which generates `generated/pools.json`. This file was previously
used to collect the coinbase tags and addresses and is still used by some
tools.
script which generates `pools.json`. This file was previously used to
collect the coinbase tags and addresses and is still used by some tools.

The generated files can be found in the `generated` branch.

## Origin

Expand Down

0 comments on commit 1b483c7

Please sign in to comment.