Sync #1950
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync | |
on: | |
schedule: | |
- cron: '0 * * * *' | |
permissions: | |
contents: write | |
jobs: | |
sync: | |
name: sync | |
runs-on: ubuntu-latest | |
env: | |
DOTNET_NOLOGO: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0' | |
- name: .Net Restore | |
run: dotnet restore | |
- name: .Net Build | |
run: dotnet build --no-restore | |
- name: .Net Test | |
run: dotnet test -f net8.0 --no-build --no-restore | |
- name: Get data | |
run: dotnet run --project src/TorNodesParser | |
- name: Push data | |
run: | | |
find src/TorNodesParser -name '*.csv' -exec mv -t . {} + | |
if [ ! -f latest.all.csv ] || [ "$(diff latest.all.csv all.csv)" != "" ] | |
then | |
mv all.csv latest.all.csv | |
git add latest.all.csv | |
fi | |
if [ ! -f latest.guards.csv ] || [ "$(diff latest.guards.csv guards.csv)" != "" ] | |
then | |
mv guards.csv latest.guards.csv | |
git add latest.guards.csv | |
fi | |
if [ ! -f latest.exits.csv ] || [ "$(diff latest.exits.csv exits.csv)" != "" ] | |
then | |
mv exits.csv latest.exits.csv | |
git add latest.exits.csv | |
fi | |
if [[ `git diff --cached` ]] | |
then | |
git config user.name github-actions[bot] | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
git commit -m "chore: auto sync" -m "[skip ci]" | |
git push | |
fi |