Просмотр исходного кода

Add a CI action to sync up the class reference

Yuri Sizov 2 лет назад
Родитель
Сommit
f846dd9eb4
1 измененных файлов с 63 добавлено и 0 удалено
  1. 63 0
      .github/workflows/sync_class_ref.yml

+ 63 - 0
.github/workflows/sync_class_ref.yml

@@ -0,0 +1,63 @@
+name: Sync Class Reference
+
+on:
+  workflow_dispatch:
+
+# Make sure jobs cannot overlap.
+concurrency:
+  group: classref-sync-ci
+  cancel-in-progress: true
+
+jobs:
+  build:
+    name: Update class reference files based on the engine revision
+    runs-on: ubuntu-latest
+    env:
+      engine_rev: '3.5'
+
+    steps:
+      - name: Checkout the documentation repository
+        uses: actions/checkout@v3
+
+      - name: Checkout the engine repository
+        uses: actions/checkout@v3
+        with:
+          repository: 'godotengine/godot'
+          # Use the appropriate branch for the documentation version.
+          ref: ${{ env.engine_rev }}
+          path: './.engine-src'
+
+      - name: Store the engine revision
+        id: 'engine'
+        run: |
+          cd ./.engine-src
+          hash=$(git rev-parse HEAD)
+          hash_short=$(git rev-parse --short HEAD)
+          echo "Checked out godotengine/godot at $hash"
+          echo "rev_hash=$hash" >> $GITHUB_OUTPUT
+          echo "rev_hash_short=$hash_short" >> $GITHUB_OUTPUT
+
+      - name: Remove old documentation
+        run: |
+          rm ./classes/class_*.rst
+
+      - name: Build new documentation
+        run: |
+          ./.engine-src/doc/tools/make_rst.py --color -o ./classes -l en ./.engine-src/doc/classes ./.engine-src/modules
+
+      - name: Submit a pull-request
+        uses: peter-evans/create-pull-request@v5
+        with:
+          commit-message: 'classref: Sync with current ${{ env.engine_rev }} branch (${{ steps.engine.outputs.rev_hash_short }})'
+          branch: 'classref/sync-${{ steps.engine.outputs.rev_hash_short }}'
+          add-paths: './classes'
+          delete-branch: true
+
+          # Configure the commit author.
+          author: 'Godot Organization <[email protected]>'
+          committer: 'Godot Organization <[email protected]>'
+
+          # Configure the pull-request.
+          title: 'classref: Sync with current ${{ env.engine_rev }} branch (${{ steps.engine.outputs.rev_hash_short }})'
+          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 }}`).'
+          labels: 'area:class reference,bug,enhancement'