Audit Bootnodes #269
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: Audit Bootnodes | |
on: | |
schedule: | |
- cron: '0 6 * * *' | |
pull_request: | |
branches: | |
- 'master' | |
paths: | |
- 'params/bootnode*' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Audit Bootnodes | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.21' | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Build bin/devp2p | |
run: | | |
mkdir -p build/bin | |
go build -o build/bin/devp2p ./cmd/devp2p | |
- name: Audit Bootnodes | |
shell: bash | |
run: | | |
healthcheck() { | |
enode_list="$(cat "$1" |grep -E 'enode://' | sed 's-"--g' | sed 's-\t--g'| sed 's/,.*//g')" | |
echo "$enode_list" | while read -r line; do | |
if >/dev/null 2>&1 ./build/bin/devp2p discv4 ping "${line}"; then | |
>&2 echo "PASS: ${line}" | |
else | |
echo "${line}" | |
fi | |
done | |
} | |
status=0 | |
while read -r file; do | |
echo "Auditing ${file}" | |
healthcheck "${file}" | while read -r failed; do | |
echo "FAIL: ${failed}" | |
if [[ $GITHUB_EVENT_NAME != pull_request ]]; then | |
id="$(basename ${failed} | cut -d'@' -f1)" | |
sed -i '/'"${id}"'/d' "${file}" | |
gofmt -w "${file}" | |
else | |
status=1 | |
fi | |
done | |
done < <(find ./params -type f -name '*bootnode*go') | |
if [[ $GITHUB_EVENT_NAME != pull_request ]]; then git --no-pager diff; fi | |
exit $status | |
- name: Create Pull Request | |
if: github.event_name != 'pull_request' | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
commit-message: 'params: remove unresponsive bootnodes' | |
title: 'params: remove unresponsive bootnodes' | |
body: | | |
These bootnodes did not respond to `./build/bin/devp2p discv4 ping` requests. | |
For details: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}. | |
branch: remove-stale-bootnodes |