1
0

monthly-check.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. name: Monthly check GitHub usernames
  2. on:
  3. workflow_dispatch:
  4. schedule:
  5. - cron: "0 0 1 * *"
  6. jobs:
  7. check-usernames:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: Restore lychee cache
  11. id: restore-cache
  12. uses: actions/cache/restore@v4
  13. with:
  14. path: .lycheecache
  15. key: cache-lychee-${{ github.sha }}
  16. restore-keys: cache-lychee-
  17. - uses: actions/checkout@v4
  18. with:
  19. fetch-depth: 0
  20. - run: |
  21. cat .github/CODEOWNERS | grep -o "@[a-zA-Z0-9_-]\+" | sort -u | sed 's/@/https:\/\/api.github.com\/users\//' > usernames.txt
  22. cat MAINTAINERS.md | grep -o "\*\*.*@[a-zA-Z0-9_-]\+.*\*\*" | grep -o "@[a-zA-Z0-9_-]\+" | sort -u | sed 's/@/https:\/\/api.github.com\/users\//' >> usernames.txt
  23. sort -u usernames.txt -o usernames.txt
  24. - name: Lychee URL checker
  25. uses: lycheeverse/lychee-action@v2
  26. id: lychee
  27. continue-on-error: true
  28. with:
  29. args: >-
  30. --cache
  31. --verbose
  32. --no-progress
  33. --max-concurrency 25
  34. usernames.txt
  35. env:
  36. GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
  37. - name: Find the last report issue open
  38. uses: micalevisk/last-issue-action@v2
  39. id: last-issue
  40. with:
  41. state: open
  42. labels: check usernames
  43. env:
  44. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  45. - name: Update last report open issue created
  46. if: ${{ env.lychee_exit_code != 0 }}
  47. uses: peter-evans/create-issue-from-file@v5
  48. with:
  49. title: GitHub usernames with errors
  50. content-filepath: lychee/out.md
  51. issue-number: ${{ steps.last-issue.outputs.issue-number }}
  52. labels: check usernames
  53. - name: Close last report open issue
  54. if: ${{ env.lychee_exit_code == 0 && steps.last-issue.outputs.has-found == 'true' }}
  55. run: gh issue close ${{ steps.last-issue.outputs.issue-number }}
  56. - name: Save lychee cache
  57. uses: actions/cache/save@v4
  58. if: always()
  59. with:
  60. path: .lycheecache
  61. key: ${{ steps.restore-cache.outputs.cache-primary-key }}