services-json.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. name: Services Validator
  2. on:
  3. push:
  4. paths:
  5. - "plugins/rtmp-services/data/services.json"
  6. - "plugins/rtmp-services/data/package.json"
  7. pull_request:
  8. paths:
  9. - "plugins/rtmp-services/data/services.json"
  10. - "plugins/rtmp-services/data/package.json"
  11. schedule:
  12. - cron: 0 0 * * *
  13. workflow_dispatch:
  14. jobs:
  15. schema:
  16. name: Schema
  17. runs-on: [ubuntu-latest]
  18. steps:
  19. - name: Checkout
  20. uses: actions/checkout@v3
  21. - name: Install & Configure Python
  22. run: |
  23. sudo apt install python3.9-dev
  24. python3.9 -m pip install jsonschema json_source_map
  25. - name: Validate Service JSON Schema
  26. run: |
  27. JSON_FILES=(
  28. plugins/rtmp-services/data/services.json
  29. plugins/rtmp-services/data/package.json
  30. )
  31. python3.9 CI/check-jsonschema.py "${JSON_FILES[@]}"
  32. - name: Annotate Errors
  33. if: failure()
  34. uses: yuzutech/[email protected]
  35. with:
  36. repo-token: "${{ secrets.GITHUB_TOKEN }}"
  37. title: "Service JSON Errors"
  38. input: "./validation_errors.json"
  39. service_check:
  40. name: Service Check
  41. runs-on: ubuntu-20.04
  42. needs: schema
  43. if: ${{ github.repository_owner == 'obsproject' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }}
  44. steps:
  45. - name: Checkout
  46. uses: actions/checkout@v3
  47. with:
  48. fetch-depth: 0
  49. - name: Restore cache
  50. uses: actions/cache@v3
  51. with:
  52. path: ${{ github.workspace }}/other
  53. key: service-check
  54. - name: Install & Configure Python
  55. run: |
  56. sudo apt install python3.9
  57. python3.9 -m pip install requests
  58. - name: Check Services
  59. id: check
  60. run: python3.9 -u CI/check-services.py
  61. env:
  62. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  63. WORKFLOW_RUN_ID: ${{ github.run_id }}
  64. REPOSITORY: ${{ github.repository }}
  65. - uses: actions/upload-artifact@v3
  66. with:
  67. name: timestamps
  68. path: ${{ github.workspace }}/other/*
  69. - name: Create Pull Request
  70. uses: peter-evans/create-pull-request@f094b77505fb89581e68a1163fbd2fffece39da1
  71. if: steps.check.outputs.make_pr == 'true'
  72. with:
  73. author: "Service Checker <[email protected]>"
  74. commit-message: "rtmp-services: Remove defunct servers/services"
  75. title: "rtmp-services: Remove defunct servers/services"
  76. branch: "automated/clean-services"
  77. body: ${{ fromJSON(steps.check.outputs.pr_message) }}
  78. delete-branch: true