Skip to content

Refresh TOR Nodes List #185

Refresh TOR Nodes List

Refresh TOR Nodes List #185

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Refresh TOR Nodes List
# Controls when the workflow will run
on:
schedule:
- cron: "10 10 * * *"
# Triggers the workflow on push or pull request events but only for the "main" branch
#push:
#branches: [ "main" ]
#pull_request:
#branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Runs a single command using the runners shell
- name: Fetch data and save to CSV
# Limited to 50 results, to test functionality.
# run: curl 'https://onionoo.torproject.org/details?limit=50' | jq -r '.relays[] | [.nickname, ([.flags[]] | join("|")), .country_name, .country, (.or_addresses[0]|split(":")[0]), (.or_addresses[0]|split(":")[1]), .running, .verified_host_names[]? // "NULL"] | @csv' > limited_to_50.csv
run: curl 'https://onionoo.torproject.org/details' | jq -r '.relays[] | [.nickname, ([.flags[]] | join("|")), .country, (.or_addresses[0]|split(":")[0]), (.or_addresses[0]|split(":")[1]), .running, .verified_host_names[]? // "NULL"] | @csv' > tor_feed.csv
- name: Fetch data and save to CSV - Include Header
run: echo '"nickname","flags","country_code","ip","port","is_running","verified_hostname"' > limited_to_50.csv && curl 'https://onionoo.torproject.org/details?limit=50' | jq -r '.relays[] | [.nickname, ([.flags[]] | join("|")), .country, (.or_addresses[0]|split(":")[0]), (.or_addresses[0]|split(":")[1]), .running, .verified_host_names[]? // "NULL"] | @csv' >> limited_to_50.csv
- name: Fetch data and save to JSON
run: curl 'https://onionoo.torproject.org/details' | jq -r '[.relays[] | {nickname:.nickname, flags:.flags, country:.country, country_name:.country_name, addresses:.or_addresses, running:.running, verified_host_names:.verified_host_names}] | @json' > tor_feed.json
# Runs a set of commands using the runners shell
- name: Head the CSV to confirm
run: echo -e 'tor_feed.csv -->' && head tor_feed.csv && echo -e '\nlimited_to_50.csv -->\n' && head limited_to_50.csv && echo -e '\ntor_feed.json -->\n' && head tor_feed.json
- name: Commit files # commit the output folder
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action test"
git add ./tor_feed.csv ./limited_to_50.csv ./tor_feed.json
git commit -m "Add changes"
- name: Push changes # push the output folder to your repo
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main