diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml new file mode 100644 index 00000000000..b2e9abd34c9 --- /dev/null +++ b/.github/workflows/sync.yml @@ -0,0 +1,50 @@ +name: Sync with SEAL blocklists + +on: workflow_dispatch + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + sync: + runs-on: ubuntu-latest + + steps: + - name: Checkout eth-phishing-detect + uses: actions/checkout@v4 + with: + path: eth-phishing-detect + + - name: Checkout blocklists + uses: actions/checkout@v4 + with: + repository: security-alliance/blocklists + path: blocklists + + - name: Sync + run: | + cd $GITHUB_WORKSPACE/eth-phishing-detect + + cat $GITHUB_WORKSPACE/blocklists/domain.txt $GITHUB_WORKSPACE/blocklists/ip.txt $GITHUB_WORKSPACE/blocklists/ipfs.txt \ + | grep -v '^$' \ + | jq --raw-input . \ + | jq --slurpfile newBlacklist /dev/stdin '. + {blacklist: $newBlacklist}' src/config.json \ + > temp.json + + mv temp.json src/config.json + + git add . + + if git diff-index --quiet HEAD; then + echo "no changes to commit" + exit 0 + fi + + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + git commit -m "sync blocklist" + + git push +