Dead Domain Cleanup #1
This file contains hidden or 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: Dead Domain Cleanup | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| sample_size: | |
| description: 'Domains to sample per list' | |
| required: false | |
| default: '500' | |
| create_issue: | |
| description: 'Create issue with results' | |
| required: false | |
| type: boolean | |
| default: true | |
| schedule: | |
| # Monthly on the 1st at 3 AM UTC | |
| - cron: '0 3 1 * *' | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| check-dead-domains: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e . | |
| - name: Check for dead domains | |
| id: check | |
| run: | | |
| SAMPLE_SIZE="${{ github.event.inputs.sample_size || '500' }}" | |
| python scripts/check-dead-domains.py \ | |
| --all \ | |
| --sample $SAMPLE_SIZE \ | |
| --output dead-domains.txt \ | |
| --verbose \ | |
| 2>&1 | tee check-output.txt | |
| # Extract summary for issue | |
| DEAD_COUNT=$(grep -oP 'Total dead domains: \K[\d,]+' check-output.txt || echo "0") | |
| CHECKED_COUNT=$(grep -oP 'Total domains checked: \K[\d,]+' check-output.txt || echo "0") | |
| echo "dead_count=$DEAD_COUNT" >> $GITHUB_OUTPUT | |
| echo "checked_count=$CHECKED_COUNT" >> $GITHUB_OUTPUT | |
| - name: Upload results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dead-domain-report | |
| path: | | |
| dead-domains.txt | |
| check-output.txt | |
| retention-days: 90 | |
| - name: Create issue with results | |
| if: ${{ github.event.inputs.create_issue != 'false' && steps.check.outputs.dead_count != '0' }} | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const deadDomains = fs.readFileSync('dead-domains.txt', 'utf8'); | |
| const output = fs.readFileSync('check-output.txt', 'utf8'); | |
| // Extract summary section | |
| const summaryMatch = output.match(/SUMMARY[\s\S]*$/); | |
| const summary = summaryMatch ? summaryMatch[0] : 'See attached artifacts.'; | |
| const deadCount = '${{ steps.check.outputs.dead_count }}'; | |
| const checkedCount = '${{ steps.check.outputs.checked_count }}'; | |
| const body = `## Dead Domain Report | |
| **Date:** ${new Date().toISOString().split('T')[0]} | |
| **Domains Checked:** ${checkedCount} | |
| **Dead Domains Found:** ${deadCount} | |
| ### Summary | |
| \`\`\` | |
| ${summary} | |
| \`\`\` | |
| ### Dead Domains Sample | |
| <details> | |
| <summary>Click to expand (first 100 domains)</summary> | |
| \`\`\` | |
| ${deadDomains.split('\n').slice(0, 100).join('\n')} | |
| \`\`\` | |
| </details> | |
| ### Action Items | |
| - [ ] Review dead domains for potential removal | |
| - [ ] Check if domains are intentionally parked/blocked | |
| - [ ] Update lists as needed | |
| --- | |
| *This issue was automatically generated by the Dead Domain Cleanup workflow.* | |
| `; | |
| await github.rest.issues.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| title: `[Maintenance] Dead Domain Report - ${new Date().toISOString().split('T')[0]}`, | |
| body: body, | |
| labels: ['maintenance', 'automated'] | |
| }); |