Skip to content

Commit

Permalink
Issue #89: Implement same fix for yaml to keep a standard
Browse files Browse the repository at this point in the history
  • Loading branch information
SonOfLope committed Apr 5, 2024
1 parent 604e042 commit 01a496d
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/workflow-yaml-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,21 @@ jobs:
.yamllint.yml
sparse-checkout-cone-mode: false

- name: Determine yaml lint config file
id: lintconfig
run: |
if [ -z "${{ inputs.config-file-path }}" ]; then
echo "::set-output name=lint_config_path::github-workflows/.yamllint.yml"
else
echo "::set-output name=lint_config_path::${{ inputs.config-file-path }}"
fi
- name: Lint YAML files
run: |
files=$(echo '${{ steps.files.outputs.all }}' | jq -r '.[]')
for file in $files; do
if [[ -f "$file" && ( $file == *.yml || $file == *.yaml ) ]]; then
# Check if a custom config path is provided and file exists
if [ -n "${{ github.event.inputs.config-file-path }}" ]; then
yamllint -c "${{ github.workspace }}/${{ github.event.inputs.config-file-path }}" "$file"
else
yamllint -c github-workflows/.yamllint.yml "$file"
fi
if [[ -f "$file" && ( $file == *.yml || $file == *.yaml ) ]]; then
yamllint -c "${{ github.workspace }}/${{ steps.lintconfig.outputs.lint_config_path }}" "$file"
fi
done
shell: bash

0 comments on commit 01a496d

Please sign in to comment.