sync_class_ref.yml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. name: Sync Class Reference
  2. on:
  3. workflow_dispatch:
  4. # Scheduled updates only run on the default/master branch.
  5. # Other branches need to be run manually (usually after a new release for that branch).
  6. schedule:
  7. # Run it at (European) night time every Saturday.
  8. # The offset is there to try and avoid high load times.
  9. - cron: '15 3 * * 6'
  10. # Make sure jobs cannot overlap.
  11. concurrency:
  12. group: classref-sync-ci-${{ github.ref_name }}
  13. cancel-in-progress: true
  14. jobs:
  15. build:
  16. # Don't run scheduled runs on forks unless the CI_SYNC_CLASS_REF_CRON variable is set to 'true'.
  17. # Manual runs can still be triggered as normal.
  18. if: ${{ github.repository_owner == 'godotengine' || github.event_name != 'schedule' || vars.CI_SYNC_CLASS_REF_CRON == 'true' }}
  19. name: Update class reference files based on the engine revision
  20. runs-on: ubuntu-24.04
  21. timeout-minutes: 10
  22. env:
  23. engine_rev: 'master'
  24. permissions:
  25. contents: write
  26. pull-requests: write
  27. steps:
  28. - name: Checkout the documentation repository
  29. uses: actions/checkout@v4
  30. - name: Checkout the engine repository
  31. uses: actions/checkout@v4
  32. with:
  33. repository: 'godotengine/godot'
  34. # Use the appropriate branch for the documentation version.
  35. ref: ${{ env.engine_rev }}
  36. path: './.engine-src'
  37. - name: Store the engine revision
  38. id: 'engine'
  39. run: |
  40. cd ./.engine-src
  41. hash=$(git rev-parse HEAD)
  42. hash_short=$(git rev-parse --short HEAD)
  43. echo "Checked out godotengine/godot at $hash"
  44. echo "rev_hash=$hash" >> $GITHUB_OUTPUT
  45. echo "rev_hash_short=$hash_short" >> $GITHUB_OUTPUT
  46. - name: Remove old documentation
  47. run: |
  48. rm ./classes/class_*.rst
  49. - name: Build new documentation
  50. run: |
  51. ./.engine-src/doc/tools/make_rst.py --color -o ./classes -l en ./.engine-src/doc/classes ./.engine-src/modules ./.engine-src/platform
  52. - name: Submit a pull-request
  53. uses: peter-evans/create-pull-request@v7
  54. with:
  55. commit-message: 'classref: Sync with current ${{ env.engine_rev }} branch (${{ steps.engine.outputs.rev_hash_short }})'
  56. branch: 'classref/sync-${{ steps.engine.outputs.rev_hash_short }}'
  57. add-paths: './classes'
  58. delete-branch: true
  59. # Configure the commit author.
  60. author: 'Godot Organization <noreply@godotengine.org>'
  61. committer: 'Godot Organization <noreply@godotengine.org>'
  62. # Configure the pull-request.
  63. title: 'classref: Sync with current ${{ env.engine_rev }} branch (${{ steps.engine.outputs.rev_hash_short }})'
  64. body: 'Update Godot API online class reference to match the engine at https://github.com/godotengine/godot/commit/${{ steps.engine.outputs.rev_hash }} (`${{ env.engine_rev }}`).'
  65. labels: 'area:class reference,bug,enhancement'