Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ci): improve logging in the reviewdog workflow #37292

Merged
merged 3 commits into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 36 additions & 9 deletions .github/workflows/pr-check-lint_content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ jobs:
echo "FM_LINT_FAILED=${FM_LINT_FAILED}" >> $GITHUB_ENV

echo "Running Prettier"
PRETTIER_FAILED=false
PRETTIER_LOG=$(yarn prettier --check ${files_to_lint} 2>&1) || PRETTIER_FAILED=true
echo "PRETTIER_LOG<<${EOF}" >> $GITHUB_ENV
echo "${PRETTIER_LOG}" >> $GITHUB_ENV
echo "${EOF}" >> $GITHUB_ENV
echo "PRETTIER_FAILED=${PRETTIER_FAILED}" >> $GITHUB_ENV
yarn prettier -w ${files_to_lint}

if [[ -n $(git diff) ]]; then
Expand All @@ -110,16 +116,17 @@ jobs:
# info for troubleshooting
echo MD_LINT_FAILED=${MD_LINT_FAILED}
echo FM_LINT_FAILED=${FM_LINT_FAILED}
echo PRETTIER_FAILED=${PRETTIER_FAILED}
git diff

- name: Setup reviewdog
if: env.FILES_MODIFIED == 'true' || env.MD_LINT_FAILED == 'true'
if: ${{ env.FILES_MODIFIED == 'true' || env.MD_LINT_FAILED == 'true' }}
uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest

- name: Suggest changes using diff
if: env.FILES_MODIFIED == 'true'
if: ${{ env.FILES_MODIFIED == 'true' }}
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -134,7 +141,7 @@ jobs:
-reporter=github-pr-review < "${TMPFILE}"

- name: Add reviews for markdownlint errors
if: env.MD_LINT_FAILED == 'true'
if: ${{ env.MD_LINT_FAILED == 'true' }}
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -147,11 +154,31 @@ jobs:
-reporter="github-pr-review"

- name: Fail if any issues pending
if: env.FILES_MODIFIED == 'true' || env.MD_LINT_FAILED == 'true' || env.FM_LINT_FAILED == 'true'
if: ${{ env.FILES_MODIFIED == 'true' || env.MD_LINT_FAILED == 'true' || env.FM_LINT_FAILED == 'true' }}
env:
MD_LINT_FAILED: ${{ env.MD_LINT_FAILED }}
FM_LINT_FAILED: ${{ env.FM_LINT_FAILED }}
PRETTIER_FAILED: ${{ env.PRETTIER_FAILED }}
MD_LINT_LOG: ${{ env.MD_LINT_LOG }}
FM_LINT_LOG: ${{ env.FM_LINT_LOG }}
PRETTIER_LOG: ${{ env.PRETTIER_LOG }}
run: |
echo -e "\nLogs from markdownlint:"
echo "${MD_LINT_LOG}"
echo -e "\nLogs from front-matter linter:"
echo "${FM_LINT_LOG}"
echo -e "\nPlease fix all the linting issues mentioned in above logs and in the review comments."
echo -e "\nPlease fix all the linting issues mentioned in the following logs and in the PR review comments."

if [[ ${MD_LINT_FAILED} == 'true' ]]; then
echo -e "\n\n🪵 Logs from markdownlint:"
echo "${MD_LINT_LOG}"
fi

if [[ ${FM_LINT_FAILED} == 'true' ]]; then
echo -e "\n\n🪵 Logs from front-matter linter:"
echo "${FM_LINT_LOG}"
fi

if [[ ${PRETTIER_FAILED} == 'true' ]]; then
echo -e "\n\n🪵 Logs from Prettier formatter:"
echo "${PRETTIER_LOG}"
echo -e "\nYou can use Prettier playground to format the files online: https://prettier.io/playground/#N4Igxg9gdgLgprEAuEBiABABwIYGd7owAWc6CMAlgE6kBmFANqSTSADQgSaXS7KjYqVCAHcACoIR8U2BiOwBPPhwBGVbGADWcGAGVsAWzgAZClDjJas3HFXqtO3TjBmA5shhUArrZA2DFB7evnAAHphwVBRGsLIAKpFQghRw0lYMNhy4bkwAil4Q8JbWvgBWuKG6OXD5hRZI6ZkgAI4F8GLCmNIgeAC05nAAJkPsIJ7YjG4AwhAGBtjIPQwMo9lQrkwAgjCeFCpe7ZGm5sUZvkQwBgwA6kQU8LjOcLpS9xQAbvcKi2C4yiDvHwASSgw1gujAUW4m1BuhgCiYpyamGENmu6kwixRqUi7wsHDMNioMA62Fc8yRvhwVCJi3mVE0g1EUFGKLMMGuFEGxGQAA4AAwcGitahwUnkhYNEocGDYFSc7lEZAAJg4XhscTlaWlIDgBhUQ2Gg2M2HWXjJcAAYhAqPMdm5FtgDhAQABfV1AA \n"
OnkarRuikar marked this conversation as resolved.
Show resolved Hide resolved
fi

exit 1
4 changes: 4 additions & 0 deletions .vscode/dictionaries/terms-abbreviations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ ANMF
anonymization
antialiasing
antitracking
apideck
APNG
appcontent
arcosh
Expand Down Expand Up @@ -529,6 +530,7 @@ quickmenu
qvalues
QWERTZ
randomizer
rari
rasterizes
RDBMS
RDBMSes
Expand Down Expand Up @@ -562,6 +564,7 @@ retarget
retargeted
retargeting
retargetings
reviewdog
RFCOMM
RGTC
roadmaps
Expand Down Expand Up @@ -879,6 +882,7 @@ xrayed
Xrays
XRCPU
XSSI
yari
yearless
Zalgo
zoomable
Expand Down
Loading