services-json.yml 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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-20.04]
  18. if: ${{ github.repository_owner == 'obsproject' || github.event_name != 'schedule' }}
  19. steps:
  20. - name: Checkout
  21. uses: actions/checkout@v3
  22. - name: Install & Configure Python
  23. run: |
  24. sudo apt install python3.9-dev
  25. python3.9 -m pip install jsonschema json_source_map
  26. - name: Validate Service JSON Schema
  27. run: |
  28. JSON_FILES=(
  29. plugins/rtmp-services/data/services.json
  30. plugins/rtmp-services/data/package.json
  31. )
  32. python3.9 CI/check-jsonschema.py "${JSON_FILES[@]}"
  33. - name: Annotate Errors
  34. if: failure()
  35. uses: yuzutech/[email protected]
  36. with:
  37. repo-token: "${{ secrets.GITHUB_TOKEN }}"
  38. title: "Service JSON Errors"
  39. input: "./validation_errors.json"
  40. service_check:
  41. name: Service Check
  42. runs-on: ubuntu-20.04
  43. needs: schema
  44. if: ${{ github.repository_owner == 'obsproject' && github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
  45. steps:
  46. - name: Checkout
  47. uses: actions/checkout@v3
  48. with:
  49. fetch-depth: 0
  50. - name: Restore cache
  51. uses: actions/cache@v3
  52. with:
  53. path: ${{ github.workspace }}/other
  54. # Workaround to create a new cache every time, since a cache key is immutable:
  55. # https://github.com/actions/cache/blob/main/workarounds.md#update-a-cache
  56. key: service-check-${{ github.run_id }}
  57. restore-keys: service-check
  58. - name: Install & Configure Python
  59. run: |
  60. sudo apt install python3.9
  61. python3.9 -m pip install requests
  62. - name: Check Services
  63. id: check
  64. run: python3.9 -u CI/check-services.py
  65. env:
  66. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  67. WORKFLOW_RUN_ID: ${{ github.run_id }}
  68. REPOSITORY: ${{ github.repository }}
  69. - uses: actions/upload-artifact@v3
  70. with:
  71. name: timestamps
  72. path: ${{ github.workspace }}/other/*
  73. - name: Create Pull Request
  74. uses: peter-evans/create-pull-request@f094b77505fb89581e68a1163fbd2fffece39da1
  75. if: steps.check.outputs.make_pr == 'true'
  76. with:
  77. author: "Service Checker <[email protected]>"
  78. commit-message: "rtmp-services: Remove defunct servers/services"
  79. title: "rtmp-services: Remove defunct servers/services"
  80. branch: "automated/clean-services"
  81. body: ${{ fromJSON(steps.check.outputs.pr_message) }}
  82. delete-branch: true