check-urls.yml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. name: Check URLs from changed files
  2. on:
  3. push:
  4. pull_request:
  5. permissions:
  6. contents: read
  7. # This allows a subsequently queued workflow run to interrupt/wait for previous runs
  8. concurrency:
  9. group: '${{ github.workflow }} @ ${{ github.run_id }}'
  10. cancel-in-progress: false # true = interrupt, false = wait
  11. jobs:
  12. check-urls:
  13. runs-on: ubuntu-latest
  14. outputs:
  15. changed-files: ${{ steps.changed-files.outputs.all_changed_files }}
  16. steps:
  17. # NOTE: tj-actions/changed-files.
  18. # For push events you need to include fetch-depth: 0 | 2 depending on your use case.
  19. # 0: retrieve all history for all branches and tags
  20. # 1: retrieve only current commit (by default)
  21. # 2: retrieve until the preceding commit
  22. - name: Determine workflow parameters
  23. id: init-params
  24. run: |
  25. echo "::set-output name=fetch_depth::0";
  26. if [ "${{ github.event_name }}" == "pull_request" ]; then
  27. echo "::set-output name=fetch_depth::0";
  28. fi
  29. - uses: actions/checkout@v3
  30. with:
  31. fetch-depth: ${{ steps.init-params.outputs.fetch_depth }}
  32. - name: Get changed files
  33. id: changed-files
  34. uses: tj-actions/changed-files@v30.0.0
  35. with:
  36. separator: " "
  37. - uses: ruby/setup-ruby@v1
  38. with:
  39. ruby-version: 2.6
  40. - run: |
  41. gem install awesome_bot
  42. - name: Check each changed file
  43. run: |
  44. # Set field separator
  45. IFS=$' ';
  46. # Processing loop
  47. for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
  48. echo;
  49. echo "::group::Processing file... $file";
  50. awesome_bot "$file" --allow-redirect --allow-dupe --allow-ssl || true;
  51. echo "::endgroup::";
  52. done
  53. # Unset field separator
  54. unset IFS;
  55. - uses: actions/upload-artifact@v3
  56. with:
  57. name: awesomebot-results
  58. path: ${{ github.workspace }}/ab-results-*.json
  59. - name: Generate Summary Report using AwesomeBot results
  60. uses: ./.github/actions/awesomebot-gh-summary-action
  61. with:
  62. ab-root: ${{ github.workspace }}
  63. files: ${{ steps.changed-files.outputs.all_changed_files }}
  64. separator: " "
  65. append-heading: ${{ true }}