11name : Roadmap Validator
22
33on :
4- pull_request :
5- paths :
6- - ' content/qa/** '
7- - ' tools/roadmap_validator/ validate.py '
8- - ' tools/roadmap_validator/** '
9- - ' .github/workflows/roadmap-validator.yml '
4+ workflow_dispatch :
5+ inputs :
6+ paths :
7+ description : ' Space-separated paths or directories to validate'
8+ required : false
9+ default : ' '
1010 push :
1111 branches :
1212 - main
13+ - chore/roadmap-validator
1314 paths :
15+ - ' content/acz/**'
16+ - ' content/dst/**'
1417 - ' content/qa/**'
15- - ' tools/roadmap_validator/validate.py'
18+ - ' content/nes/**'
19+ - ' content/nim/**'
20+ - ' content/p2p/**'
21+ - ' content/rfc/**'
22+ - ' content/sc/**'
23+ - ' content/sec/**'
24+ - ' content/tke/**'
25+ - ' content/web/**'
1626 - ' tools/roadmap_validator/**'
1727 - ' .github/workflows/roadmap-validator.yml'
1828
1929jobs :
2030 validate :
2131 runs-on : ubuntu-latest
22- env :
23- TARGET_DIRECTORIES : " content/qa"
2432 steps :
2533 - name : Checkout
2634 uses : actions/checkout@v4
@@ -35,33 +43,28 @@ jobs:
3543 - name : Install dependencies
3644 run : pip install --disable-pip-version-check --no-cache-dir pyyaml
3745
46+ - name : Detect changed markdown files
47+ if : ${{ github.event_name != 'workflow_dispatch' }}
48+ id : changed-files
49+ uses : tj-actions/changed-files@v42
50+ with :
51+ files : |
52+ **/*.md
53+
3854 - name : Run roadmap validator
3955 run : |
4056 set -eo pipefail
41- BASE_SHA="${{ github.event.pull_request.base.sha || github.event.before }}"
42- if [ -z "$BASE_SHA" ] || [ "$BASE_SHA" = "0000000000000000000000000000000000000000" ]; then
43- CHANGED_FILES=$(git ls-files)
44- else
45- CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRT "$BASE_SHA" "$GITHUB_SHA")
46- fi
4757
48- TARGET_FILES=""
49- for file in $CHANGED_FILES; do
50- for dir in $TARGET_DIRECTORIES; do
51- case "$file" in
52- $dir/*.md)
53- if [ -f "$file" ]; then
54- TARGET_FILES="$TARGET_FILES $file"
55- fi
56- ;;
57- esac
58- done
59- done
60-
61- if [ -z "$TARGET_FILES" ]; then
62- echo "No roadmap markdown changes detected."
63- exit 0
58+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
59+ TARGETS="${{ github.event.inputs.paths }}"
60+ else
61+ TARGETS="${{ steps.changed-files.outputs.all_changed_files }}"
62+ if [ -z "$TARGETS" ]; then
63+ echo "No roadmap markdown changes detected."
64+ exit 0
65+ fi
6466 fi
6567
66- echo "Validating files:$TARGET_FILES"
67- python tools/roadmap_validator/validate.py $TARGET_FILES
68+ echo "Validating targets:"
69+ printf '%s\n' $TARGETS
70+ python tools/roadmap_validator/validate.py $TARGETS
0 commit comments