@@ -23,12 +23,18 @@ jobs:
2323 persist-credentials : false
2424 - name : Install Apt-Get Dependencies
2525 run : |
26- sudo apt-get update
27- sudo apt-get install -y yamllint npm
28- ERR_MSG_STUB="yamllint installation failed."
29- ERR_DETAILS="file=.github/workflows/markdown-lint.yml,line=26,endLine=31,title=FAILURE"
30- ERR_MSG_LINE="::error ${ERR_DETAILS}::ERROR ${ERR_MSG_STUB}"
31- yamllint --version || { printf "%s\n" "${ERR_MSG_LINE}"; exit 1; }
26+ sudo apt-get update || exit 1
27+ sudo apt-get install -y yamllint npm || : # handle error with detail below
28+ print_error() {
29+ local msg="$1"
30+ local file_stub=".github/workflows/markdown-lint.yml"
31+ local line_start="$2"
32+ local line_end="$3"
33+ printf "::error file=%s,line=%s,endLine=%s,title=VALIDATION_ERROR::ERROR %s\n" \
34+ "${file_stub}" "${line_start}" "${line_end}" "${msg}"
35+ }
36+ command -v npm >/dev/null || { print_error "npm installation failed." 26 27 ; exit 126; }
37+ yamllint --version || { print_error "Yamllint installation failed." 26 27 ; exit 126; }
3238
3339 - name : Lint Workflow YAML
3440 if : ${{ success() }}
4147 exit 1
4248 else
4349 printf "::notice file=.github/workflows/markdown-lint.yml,%s %s\n" \
44- "line=36 ,endLine=47 ,title=Validation::Validating workflow with args:" \
50+ "line=42 ,endLine=43 ,title=Validation::Validating workflow with args:" \
4551 "${YAML_ARGS}"
4652 read -ra ARGS <<< "${YAML_ARGS}"
4753 yamllint "${ARGS[@]}" .github/workflows/markdown-lint.yml
5157 run : |
5258 # npm install
5359 ERR_MSG="NPM package installation failed"
54- ERR_LOC_1="file=.github/workflows/markdown-lint.yml,line=56 ,endLine=56 "
60+ ERR_LOC_1="file=.github/workflows/markdown-lint.yml,line=62 ,endLine=62 "
5561 ERR_LOC_2="file=package.json,line=2,endLine=4"
5662 if ! NPM_ERROR=$(npm install 2>&1); then
5763 for LOC in "${ERR_LOC_1}" "${ERR_LOC_2}"; do
6268
6369 - name : Lint YAML config for markdown
6470 run : |
65- yamllint -f github --no-warnings .markdownlint.yaml
71+ YAML_ARGS="${{ vars.YAML_ARGS }}"
72+ read -ra ARGS <<< "${YAML_ARGS}"
73+ yamllint ${{ vars.YAML_ARGS }} .markdownlint.yaml
6674
6775 - name : Lint Markdown Files with YAML config
6876 if : ${{ !cancelled() }}
0 commit comments