Skip to content

Commit 0f91167

Browse files
Only run if IDLE docs are modified
1 parent 471961e commit 0f91167

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ jobs:
5151

5252
check-idle-help-doc:
5353
name: IDLE help doc
54-
needs: check-docs
54+
needs: [build-context, check-docs]
55+
if: fromJSON(needs.build-context.outputs.run-idle-help-doc)
5556
uses: ./.github/workflows/reusable-idle-help-doc.yml
5657

5758
check-autoconf-regen:

.github/workflows/reusable-context.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ on: # yamllint disable-line rule:truthy
2626
run-docs:
2727
description: Whether to build the docs
2828
value: ${{ jobs.compute-changes.outputs.run-docs }} # bool
29+
run-idle-help-doc:
30+
description: Whether to check the IDLE help doc check
31+
value: ${{ jobs.compute-changes.outputs.run-idle-help-doc }} # bool
2932
run-ios:
3033
description: Whether to run the iOS tests
3134
value: ${{ jobs.compute-changes.outputs.run-ios }} # bool
@@ -57,6 +60,7 @@ jobs:
5760
run-android: ${{ steps.changes.outputs.run-android }}
5861
run-ci-fuzz: ${{ steps.changes.outputs.run-ci-fuzz }}
5962
run-docs: ${{ steps.changes.outputs.run-docs }}
63+
run-idle-help-doc: ${{ steps.changes.outputs.run-idle-help-doc }}
6064
run-ios: ${{ steps.changes.outputs.run-ios }}
6165
run-macos: ${{ steps.changes.outputs.run-macos }}
6266
run-tests: ${{ steps.changes.outputs.run-tests }}

Tools/build/compute-changes.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import os
1313
import subprocess
14-
from dataclasses import dataclass
14+
from dataclasses import dataclass, fields
1515
from pathlib import Path
1616

1717
TYPE_CHECKING = False
@@ -56,6 +56,7 @@ class Outputs:
5656
run_android: bool = False
5757
run_ci_fuzz: bool = False
5858
run_docs: bool = False
59+
run_idle_help_doc: bool = False
5960
run_ios: bool = False
6061
run_macos: bool = False
6162
run_tests: bool = False
@@ -148,6 +149,7 @@ def process_changed_files(changed_files: Set[Path]) -> Outputs:
148149
run_tests = False
149150
run_ci_fuzz = False
150151
run_docs = False
152+
run_idle_help_doc = False
151153
run_windows_tests = False
152154
run_windows_msi = False
153155

@@ -201,6 +203,10 @@ def process_changed_files(changed_files: Set[Path]) -> Outputs:
201203
if doc_file:
202204
run_docs = True
203205

206+
# Check for changed IDLE docs
207+
if file == Path("Doc/library/idle.rst"):
208+
run_idle_help_doc = True
209+
204210
# Check for changed MSI installer-related files
205211
if file.parts[:2] == ("Tools", "msi"):
206212
run_windows_msi = True
@@ -230,6 +236,7 @@ def process_changed_files(changed_files: Set[Path]) -> Outputs:
230236
run_android=run_android,
231237
run_ci_fuzz=run_ci_fuzz,
232238
run_docs=run_docs,
239+
run_idle_help_doc=run_idle_help_doc,
233240
run_ios=run_ios,
234241
run_macos=run_macos,
235242
run_tests=run_tests,
@@ -263,16 +270,10 @@ def write_github_output(outputs: Outputs) -> None:
263270
return
264271

265272
with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as f:
266-
f.write(f"run-android={bool_lower(outputs.run_android)}\n")
267-
f.write(f"run-ci-fuzz={bool_lower(outputs.run_ci_fuzz)}\n")
268-
f.write(f"run-docs={bool_lower(outputs.run_docs)}\n")
269-
f.write(f"run-ios={bool_lower(outputs.run_ios)}\n")
270-
f.write(f"run-macos={bool_lower(outputs.run_macos)}\n")
271-
f.write(f"run-tests={bool_lower(outputs.run_tests)}\n")
272-
f.write(f"run-ubuntu={bool_lower(outputs.run_ubuntu)}\n")
273-
f.write(f"run-wasi={bool_lower(outputs.run_wasi)}\n")
274-
f.write(f"run-windows-msi={bool_lower(outputs.run_windows_msi)}\n")
275-
f.write(f"run-windows-tests={bool_lower(outputs.run_windows_tests)}\n")
273+
for field in fields(outputs):
274+
name = field.name.replace("_", "-")
275+
val = bool_lower(getattr(outputs, field.name))
276+
f.write(f"{name}={val}\n")
276277

277278

278279
def bool_lower(value: bool, /) -> str:

0 commit comments

Comments
 (0)