Skip to content

Commit

Permalink
fix(ci/pr-check-lint): run front matter lint with correct context (#1…
Browse files Browse the repository at this point in the history
…5662)

* fix(ci/pr-check-lint): run front matter lint with correct context

* fix use absolute path instead
  • Loading branch information
yin1999 authored Sep 6, 2023
1 parent ef33abf commit f0e58b2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/pr-check-lint_content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ jobs:
echo "Linting front-matter"
FM_LINT_FAILED=false
FM_LINT_LOG=$(cd ${{ github.workspace }}/mdn/content && yarn fix:fm --config-file ${{ github.workspace }}/front-matter-config.json --fix true ${files_to_lint} 2>&1) || FM_LINT_FAILED=true
# absolute_paths is needed because front-matter linter is run from mdn/content directory
absolute_paths=$(echo "${files_to_lint}" | xargs realpath -e | xargs)
FM_LINT_LOG=$(cd ${{ github.workspace }}/mdn/content && yarn fix:fm --config-file ${{ github.workspace }}/front-matter-config.json ${absolute_paths} 2>&1) || FM_LINT_FAILED=true
echo "FM_LINT_LOG<<${EOF}" >> $GITHUB_ENV
echo "${FM_LINT_LOG}" >> $GITHUB_ENV
echo "${EOF}" >> $GITHUB_ENV
Expand All @@ -121,6 +123,7 @@ jobs:
# info for troubleshooting
echo MD_LINT_FAILED=${MD_LINT_FAILED}
echo FM_LINT_FAILED=${FM_LINT_FAILED}
git diff
- name: Setup reviewdog
Expand Down Expand Up @@ -157,9 +160,11 @@ jobs:
-reporter="github-pr-review"
- name: Fail if any issues pending
if: env.FILES_MODIFIED == 'true' || env.MD_LINT_FAILED == 'true'
if: env.FILES_MODIFIED == 'true' || env.MD_LINT_FAILED == 'true' || env.FM_LINT_FAILED == 'true'
run: |
echo -e "\nLogs from markdownlint:"
echo "${{ env.MD_LINT_LOG }}"
echo -e "\nLogs from front-matter linter:"
echo "${{ env.FM_LINT_LOG }}"
echo -e "\nPlease fix all the linting issues mentioned in above logs and in the review comments."
exit 1

0 comments on commit f0e58b2

Please sign in to comment.