Find Redundant Domains #393
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: Find Redundant Domains | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 23 * * *" | |
env: | |
RELEASE_NAME: $(date +%Y%m%d%H%M) | |
jobs: | |
check-domains: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install csvkit | |
- name: Install PowerShell 7.3 | |
run: | | |
curl -sSLO https://github.com/PowerShell/PowerShell/releases/download/v7.3.8/powershell_7.3.8-1.deb_amd64.deb | |
sudo dpkg -i powershell_7.3.8-1.deb_amd64.deb | |
- name: Get Check-Domains script | |
run: curl -sSLO https://raw.githubusercontent.com/Chocolate4U/Domain-Health-Checker/main/Check-Domains.ps1 | |
- name: Get domains | |
run: curl -sSL https://raw.githubusercontent.com/vuong2023/vn-v2ray-rules/main/domains.txt | grep -Ev ".+\.vn$" | sort -u > domains.txt | |
- name: Check Domains with Cloudflare | |
shell: pwsh | |
run: | | |
.\Check-Domains.ps1 -Mode DOH -DOHServer Cloudflare -Http3 -Concurrency 100 -Quiet | |
New-Item -Name "Cloudflare" -ItemType "directory" | |
Move-Item -Path "./Results-DOH.csv" -Destination "./Cloudflare" | |
- name: Check Domains with Google | |
shell: pwsh | |
run: | | |
.\Check-Domains.ps1 -Mode DOH -DOHServer Google -Http3 -Concurrency 100 -Quiet | |
New-Item -Name "Google" -ItemType "directory" | |
Move-Item -Path "./Results-DOH.csv" -Destination "./Google" | |
- name: Generate final result | |
run: | | |
csvgrep -c 2 -m "DEAD" ./Cloudflare/Results-DOH.csv | awk -F"," '{print $1}' | sed '1d' | sort -u > redundant-cloudflare.txt | |
csvgrep -c 2 -m "DEAD" ./Google/Results-DOH.csv | awk -F"," '{print $1}' | sed '1d' | sort -u > redundant-google.txt | |
comm -12 redundant-cloudflare.txt redundant-google.txt > redundant-domains.txt | |
- name: Push result to redundant branch | |
run: | | |
mkdir redundant | |
cp redundant-domains.txt redundant | |
cd redundant || exit 1 | |
git init | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git checkout -b redundant | |
git add . | |
git commit -m "${{ env.RELEASE_NAME }}" | |
git remote add origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}" | |
git push -f origin redundant |