DNS Check and Cleanup #7
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: DNS Check and Cleanup | |
| on: | |
| schedule: | |
| # Run every Monday at 2 AM UTC | |
| - cron: '0 2 * * 1' | |
| workflow_dispatch: # Allow manual triggering | |
| jobs: | |
| check-dns: | |
| if: github.repository_owner == 'PreMiD' | |
| name: Check Activity URLs via DNS | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/create-github-app-token@v2 | |
| id: generate-token | |
| with: | |
| app-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: package.json | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run DNS check | |
| id: dns-check | |
| run: npx pmd check-dns --all --fix | |
| - name: Create Pull Request | |
| if: steps.dns-check.outputs.has_changes == 'true' | |
| uses: peter-evans/create-pull-request@v8 | |
| with: | |
| token: ${{ steps.generate-token.outputs.token }} | |
| branch: dns-check-${{ github.run_id }} | |
| delete-branch: true | |
| commit-message: 'chore: remove activities with failed DNS checks' | |
| title: 'chore: remove activities with failed DNS checks' | |
| body-path: ${{ steps.dns-check.outputs.summary_path }} | |
| sign-commits: true | |
| labels: | | |
| repo maintenance | |
| ${{ steps.dns-check.outputs.has_deletions == 'true' && 'activity deletion' || '' }} | |
| ${{ steps.dns-check.outputs.has_updates == 'true' && 'activity update' || '' }} | |
| ${{ steps.dns-check.outputs.has_multiple_activities == 'true' && 'multiple activities' || '' }} |