@@ -217,7 +217,7 @@ runs:
217
217
LINT_VALE="false" # Skip Vale style checking in weekly checks
218
218
GEN_PREVIEW="false"
219
219
POST_COMMENT="false"
220
- CREATE_ISSUES="true" # Create issues for persistent problems
220
+ CREATE_ISSUES="false" # Issue creation not implemented yet (changed to false for accuracy)
221
221
FAIL_ON_ERROR="true"
222
222
echo "::notice::Applied weekly check preset configuration"
223
223
;;
@@ -330,21 +330,18 @@ runs:
330
330
# Check which tools we'll need based on enabled validations
331
331
NEEDS_PNPM="false"
332
332
NEEDS_NODE="false"
333
- NEEDS_VALE="false"
333
+ # Note: Vale is now handled via GitHub Action, not manual installation
334
334
335
335
if [ "${{ env.lint_markdown }}" == "true" ] || [ "${{ env.check_format }}" == "true" ]; then
336
336
NEEDS_PNPM="true"
337
337
NEEDS_NODE="true"
338
338
fi
339
339
340
- if [ "${{ env.lint_vale }}" == "true" ]; then
341
- NEEDS_VALE="true"
342
- fi
343
-
344
340
# Output for workflow to use
345
341
echo "needs_pnpm=$NEEDS_PNPM" >> $GITHUB_OUTPUT
346
342
echo "needs_node=$NEEDS_NODE" >> $GITHUB_OUTPUT
347
- echo "needs_vale=$NEEDS_VALE" >> $GITHUB_OUTPUT
343
+ # Vale is now handled by an action, no longer need this output
344
+ echo "needs_vale=false" >> $GITHUB_OUTPUT
348
345
349
346
# === PHASE 1D: CONTEXT EXTRACTION ===
350
347
# Centralized PR and branch information extraction
@@ -701,144 +698,65 @@ runs:
701
698
echo "message=Link checking is enabled" >> $GITHUB_OUTPUT
702
699
echo "::endgroup::"
703
700
704
- # Vale style checking - rely on the Vale installed in the parent workflow
701
+ # Use the official Vale GitHub Action for style checking
705
702
- name : Run Vale style checks
706
703
id : lint-vale
707
704
if : env.lint_vale == 'true' && steps.file-detection.outputs.has_changes == 'true'
705
+ uses : errata-ai/vale-action@reviewdog
706
+ with :
707
+ files : ${{ steps.file-detection.outputs.changed_files_csv }}
708
+ fail_on_error : false
709
+ reporter : github-check
710
+ token : ${{ inputs.github-token }}
711
+ vale_flags : " --config=.github/docs/vale/.vale.ini"
712
+
713
+ # Process Vale results for consistent output format
714
+ - name : Process Vale results
715
+ id : process-vale-results
716
+ if : env.lint_vale == 'true' && steps.file-detection.outputs.has_changes == 'true'
708
717
shell : bash
709
718
run : |
710
- echo "::group::Vale style checking "
719
+ echo "::group::Vale results processing "
711
720
712
721
# Get the files to check from the detection step
713
722
CHANGED_FILES_JSON='${{ steps.file-detection.outputs.changed_files_json }}'
714
723
715
724
# Skip if no files to check
716
725
if [ "$CHANGED_FILES_JSON" == "[]" ] || [ -z "$CHANGED_FILES_JSON" ]; then
717
- echo "No files to check with Vale"
726
+ echo "No files were checked with Vale"
718
727
echo "status=success" >> $GITHUB_OUTPUT
719
728
echo "message=No files to check" >> $GITHUB_OUTPUT
720
729
echo "::endgroup::"
721
730
exit 0
722
731
fi
723
732
724
- # Extract markdown files to check
725
- FILES_TO_CHECK =$(echo "$CHANGED_FILES_JSON" | jq -r '.[] | select(endswith(".md"))' | tr '\n' ' ')
733
+ # Extract markdown files that were checked
734
+ FILES_COUNT =$(echo "$CHANGED_FILES_JSON" | jq -r '.[] | select(endswith(".md"))' | wc -l | tr -d ' ')
726
735
727
- if [ -z "$FILES_TO_CHECK" ]; then
728
- echo "No markdown files to check "
736
+ if [ $FILES_COUNT -eq 0 ]; then
737
+ echo "No markdown files were checked "
729
738
echo "status=success" >> $GITHUB_OUTPUT
730
739
echo "message=No markdown files to check" >> $GITHUB_OUTPUT
731
740
echo "::endgroup::"
732
741
exit 0
733
742
fi
734
743
735
- echo "Found markdown files to check with Vale"
736
- FILE_COUNT=$(echo "$FILES_TO_CHECK" | wc -w | tr -d ' ')
737
- echo "Found $FILE_COUNT markdown files to check"
738
-
739
- # Verify Vale is available (should be installed by the parent workflow)
740
- if ! command -v vale &> /dev/null; then
741
- echo "Vale command not found, it should be installed by the parent workflow"
742
- echo "status=skipped" >> $GITHUB_OUTPUT
743
- echo "message=Vale not installed" >> $GITHUB_OUTPUT
744
- echo "::endgroup::"
745
- exit 0
746
- fi
747
-
748
- # Show Vale version
749
- echo "Using Vale version:"
750
- vale --version
751
-
752
- echo "Running Vale checks on $FILE_COUNT files..."
753
-
754
- # Create a temporary directory for results
755
- TEMP_DIR=$(mktemp -d)
756
- trap 'rm -rf "$TEMP_DIR"' EXIT
757
-
758
- # Run Vale on files in chunks (to avoid command line length limits)
759
- # Create chunks of files (maximum 10 files per chunk)
760
- CHUNK_SIZE=10
761
- CHUNKS=()
762
- CHUNK=""
763
- COUNT=0
764
-
765
- for FILE in $FILES_TO_CHECK; do
766
- if [ $COUNT -eq $CHUNK_SIZE ]; then
767
- CHUNKS+=("$CHUNK")
768
- CHUNK="$FILE"
769
- COUNT=1
770
- else
771
- CHUNK="$CHUNK $FILE"
772
- COUNT=$((COUNT + 1))
773
- fi
774
- done
775
-
776
- # Add the last chunk if not empty
777
- if [ -n "$CHUNK" ]; then
778
- CHUNKS+=("$CHUNK")
779
- fi
780
-
781
- # Process each chunk and combine results
782
- echo "[" > "$TEMP_DIR/combined_results.json"
783
- FIRST_CHUNK=true
744
+ # Vale action doesn't provide a specific output we can use directly
745
+ # So we'll record that it ran successfully and was integrated
784
746
785
- for ((i=0; i<${#CHUNKS[@]}; i++)); do
786
- CHUNK_FILES="${CHUNKS[$i]}"
787
- CHUNK_OUTPUT="$TEMP_DIR/chunk_$i.json"
788
-
789
- echo "Processing chunk $((i+1))/${#CHUNKS[@]} ($(echo "$CHUNK_FILES" | wc -w | tr -d ' ') files)"
790
-
791
- # Run Vale on this chunk of files
792
- vale --no-exit --output=JSON --config=.github/docs/vale/.vale.ini $CHUNK_FILES > "$CHUNK_OUTPUT" 2>/dev/null || true
793
-
794
- # Verify JSON output and append to combined results
795
- if [ -s "$CHUNK_OUTPUT" ] && jq empty "$CHUNK_OUTPUT" 2>/dev/null; then
796
- # Add separator between chunks if not first chunk
797
- if [ "$FIRST_CHUNK" = true ]; then
798
- FIRST_CHUNK=false
799
- elif [ -s "$CHUNK_OUTPUT" ]; then
800
- echo "," >> "$TEMP_DIR/combined_results.json"
801
- fi
802
-
803
- # Add content without brackets
804
- jq -c '.[]' "$CHUNK_OUTPUT" >> "$TEMP_DIR/combined_results.json" || echo "Error processing chunk $i"
805
- else
806
- echo "No valid results from chunk $i"
807
- fi
808
- done
809
-
810
- # Close the combined JSON array
811
- echo "]" >> "$TEMP_DIR/combined_results.json"
812
-
813
- # Fix JSON if needed
814
- if ! jq empty "$TEMP_DIR/combined_results.json" 2>/dev/null; then
815
- echo "Warning: Invalid combined JSON output, creating empty array"
816
- echo "[]" > "$TEMP_DIR/combined_results.json"
817
- fi
818
-
819
- # Extract and analyze results
820
- VALE_OUTPUT=$(cat "$TEMP_DIR/combined_results.json")
821
-
822
- # Store results
823
- if [ "$VALE_OUTPUT" = "[]" ] || [ "$(echo "$VALE_OUTPUT" | jq 'length')" -eq 0 ]; then
824
- echo "Vale check passed: No style issues found"
747
+ # Determine status based on Vale action
748
+ if [ "${{ steps.lint-vale.outcome }}" == "success" ]; then
749
+ echo "Vale check completed successfully"
825
750
echo "status=success" >> $GITHUB_OUTPUT
826
- echo "message=No style issues found in $FILE_COUNT files" >> $GITHUB_OUTPUT
827
- else
828
- # Count issues
829
- ISSUE_COUNT=$(echo "$VALE_OUTPUT" | jq 'length')
830
- echo "Vale found $ISSUE_COUNT style issues in $FILE_COUNT files"
831
-
832
- # Group issues by file for better readability
833
- echo "$VALE_OUTPUT" | jq -r 'group_by(.Path) | .[] | .[0].Path + ":" + (. | length | tostring) + " issues"'
834
-
835
- # Show details of first 10 issues
836
- echo "First 10 issues (detail):"
837
- echo "$VALE_OUTPUT" | jq -r '.[] | "\(.Path):\(.Line):\(.Column) - \(.Message) (\(.Check))"' | head -10
838
-
751
+ echo "message=Style checking completed on $FILES_COUNT files" >> $GITHUB_OUTPUT
752
+ elif [ "${{ steps.lint-vale.outcome }}" == "failure" ]; then
753
+ echo "Vale found style issues"
839
754
echo "status=warning" >> $GITHUB_OUTPUT
840
- echo "message=Found $ISSUE_COUNT style issues in $FILE_COUNT files" >> $GITHUB_OUTPUT
841
- echo "issues=$VALE_OUTPUT" >> $GITHUB_OUTPUT
755
+ echo "message=Style issues found in documentation" >> $GITHUB_OUTPUT
756
+ else
757
+ echo "Vale check was skipped or had issues"
758
+ echo "status=skipped" >> $GITHUB_OUTPUT
759
+ echo "message=Vale check was skipped or had issues" >> $GITHUB_OUTPUT
842
760
fi
843
761
844
762
echo "::endgroup::"
@@ -1049,7 +967,7 @@ runs:
1049
967
{
1050
968
"enabled": "${{ env.lint_vale }}",
1051
969
"name": "Vale Style",
1052
- "step_id": "lint -vale",
970
+ "step_id": "process -vale-results ",
1053
971
"guidance": "Follow style guidelines or use inline comments to suppress rules",
1054
972
"fix_command": "vale --no-exit --config=.github/docs/vale/.vale.ini <filename>"
1055
973
},
@@ -1399,9 +1317,14 @@ runs:
1399
1317
case "$CHANNEL" in
1400
1318
"github-issue")
1401
1319
if [ "${{ env.create_issues }}" == "true" ] && [ "${{ steps.format-results.outputs.has_issues }}" == "true" ]; then
1402
- echo "Would create GitHub issue here with appropriate API calls"
1403
- echo "Issue would include formatted information about failures"
1404
- echo "This is a placeholder for the actual implementation"
1320
+ echo "::warning::GitHub issue creation functionality is not implemented yet - this is a placeholder"
1321
+ echo "::notice::To implement issue creation, this would use the GitHub API to create issues for validation failures"
1322
+ echo "::notice::See: https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#create-an-issue"
1323
+ # TODO: Implementation would look like:
1324
+ # curl -X POST -H "Authorization: token ${{ inputs.github-token }}" \
1325
+ # -H "Accept: application/vnd.github+json" \
1326
+ # https://api.github.com/repos/${{ github.repository }}/issues \
1327
+ # -d '{"title":"Documentation validation issues","body":"...","labels":["documentation","bug"]}'
1405
1328
fi
1406
1329
;;
1407
1330
"slack")
0 commit comments