]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] Convert `doc.yml` workflow to be reusable (GH-103914 + GH-105151) (#107043)
authorSviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
Sun, 23 Jul 2023 09:34:56 +0000 (11:34 +0200)
committerGitHub <noreply@github.com>
Sun, 23 Jul 2023 09:34:56 +0000 (11:34 +0200)
Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>.
(cherry picked from commit 88d14da76f579fe014cbd7c15e42be4234135fe9)
(cherry picked from commit eaa670228066220f08c8d73f80365c50058d40b8)

.github/workflows/build.yml
.github/workflows/reusable-docs.yml [moved from .github/workflows/doc.yml with 89% similarity]

index 6848ed6f54bf0e3c2535daa5393514115e7c88ca..5dc63ff64e9ca24838350fbb3cd9938b75327f8d 100644 (file)
@@ -26,7 +26,7 @@ permissions:
   contents: read
 
 concurrency:
-  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
+  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}-reusable
   cancel-in-progress: true
 
 jobs:
@@ -35,6 +35,7 @@ jobs:
     runs-on: ubuntu-latest
     timeout-minutes: 10
     outputs:
+      run-docs: ${{ steps.docs-changes.outputs.run-docs || false }}
       run_tests: ${{ steps.check.outputs.run_tests }}
       run_ssl_tests: ${{ steps.check.outputs.run_ssl_tests }}
       config_hash: ${{ steps.config_hash.outputs.hash }}
@@ -68,6 +69,29 @@ jobs:
         id: config_hash
         run: |
           echo "hash=${{ hashFiles('configure', 'configure.ac', '.github/workflows/build.yml') }}" >> $GITHUB_OUTPUT
+      - name: Get a list of the changed documentation-related files
+        if: github.event_name == 'pull_request'
+        id: changed-docs-files
+        uses: Ana06/get-changed-files@v2.2.0
+        with:
+          filter: |
+            Doc/**
+            Misc/**
+            .github/workflows/reusable-docs.yml
+          format: csv  # works for paths with spaces
+      - name: Check for docs changes
+        if: >-
+          github.event_name == 'pull_request'
+          && steps.changed-docs-files.outputs.added_modified_renamed != ''
+        id: docs-changes
+        run: |
+          echo "run-docs=true" >> "${GITHUB_OUTPUT}"
+
+  check-docs:
+    name: Docs
+    needs: check_source
+    if: fromJSON(needs.check_source.outputs.run-docs)
+    uses: ./.github/workflows/reusable-docs.yml
 
   check_abi:
     name: 'Check if the ABI has changed'
similarity index 89%
rename from .github/workflows/doc.yml
rename to .github/workflows/reusable-docs.yml
index e32078c67fba6095ded84653ca42f1112d7da34c..eade14bc8d6191430f5b413eed1b6a14c1c254f7 100644 (file)
@@ -1,29 +1,8 @@
 name: Docs
 
 on:
+  workflow_call:
   workflow_dispatch:
-  #push:
-  #  branches:
-  #  - 'main'
-  #  - '3.11'
-  #  - '3.10'
-  #  - '3.9'
-  #  - '3.8'
-  #  - '3.7'
-  #  paths:
-  #  - 'Doc/**'
-  pull_request:
-    branches:
-    - 'main'
-    - '3.11'
-    - '3.10'
-    - '3.9'
-    - '3.8'
-    - '3.7'
-    paths:
-    - 'Doc/**'
-    - 'Misc/**'
-    - '.github/workflows/doc.yml'
 
 permissions:
   contents: read