-
Notifications
You must be signed in to change notification settings - Fork 22.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
738 changed files
with
29,161 additions
and
2,807 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,14 +39,14 @@ jobs: | |
echo "DIFF_DOCUMENTS=${DIFF_DOCUMENTS}" >> $GITHUB_ENV | ||
- name: Checkout HEAD | ||
if: ${{ env.DIFF_DOCUMENTS }} | ||
if: env.DIFF_DOCUMENTS | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
path: pr_head | ||
|
||
- name: Get changed content from HEAD | ||
if: ${{ env.DIFF_DOCUMENTS }} | ||
if: env.DIFF_DOCUMENTS | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "mdn-bot" | ||
|
@@ -62,28 +62,36 @@ jobs: | |
git commit -m "Code from PR head" | ||
- name: Setup Node.js environment | ||
if: ${{ env.DIFF_DOCUMENTS }} | ||
if: env.DIFF_DOCUMENTS | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: ".nvmrc" | ||
cache: yarn | ||
|
||
- name: Install all yarn packages | ||
if: ${{ env.DIFF_DOCUMENTS }} | ||
if: env.DIFF_DOCUMENTS | ||
run: yarn --frozen-lockfile | ||
env: | ||
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Lint and format markdown files | ||
if: ${{ env.DIFF_DOCUMENTS }} | ||
if: env.DIFF_DOCUMENTS | ||
run: | | ||
# Generate random delimiter | ||
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings | ||
EOF="$(openssl rand -hex 8)" | ||
files_to_lint="$DIFF_DOCUMENTS" | ||
echo "crlf line ending check" | ||
CRLF_FAILED=true | ||
CRLF_LOG=$(git ls-files --eol ${files_to_lint} | grep -E 'w/(mixed|crlf)') || CRLF_FAILED=false | ||
echo "CRLF_LOG<<${EOF}" >> $GITHUB_ENV | ||
echo "${CRLF_LOG}" >> $GITHUB_ENV | ||
echo "${EOF}" >> $GITHUB_ENV | ||
echo "CRLF_FAILED=${CRLF_FAILED}" >> $GITHUB_ENV | ||
echo "Running markdownlint --fix" | ||
MD_LINT_FAILED=false | ||
MD_LINT_LOG=$(yarn markdownlint-cli2 --fix ${files_to_lint} 2>&1) || MD_LINT_FAILED=true | ||
|
@@ -114,19 +122,20 @@ jobs: | |
fi | ||
# info for troubleshooting | ||
echo CRLF_FAILED=${CRLF_FAILED} | ||
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: | | ||
|
@@ -141,7 +150,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: | | ||
|
@@ -154,17 +163,26 @@ 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.CRLF_FAILED == 'true' || env.MD_LINT_FAILED == 'true' || env.FM_LINT_FAILED == 'true' | ||
env: | ||
CRLF_FAILED: ${{ env.CRLF_FAILED }} | ||
MD_LINT_FAILED: ${{ env.MD_LINT_FAILED }} | ||
FM_LINT_FAILED: ${{ env.FM_LINT_FAILED }} | ||
PRETTIER_FAILED: ${{ env.PRETTIER_FAILED }} | ||
CRLF_LOG: ${{ env.CRLF_LOG }} | ||
MD_LINT_LOG: ${{ env.MD_LINT_LOG }} | ||
FM_LINT_LOG: ${{ env.FM_LINT_LOG }} | ||
PRETTIER_LOG: ${{ env.PRETTIER_LOG }} | ||
run: | | ||
echo -e "\nPlease fix all the linting issues mentioned in the following logs and in the PR review comments." | ||
if [[ ${CRLF_FAILED} == 'true' ]]; then | ||
echo -e "\n\n🪵 In the following files make sure all the lines end with only Line Feed (LF) character and not with Carriage Return Line Feed (CRLF) characters:" | ||
echo "${CRLF_LOG}" | ||
echo "For more information refer https://gist.github.com/LunarLambda/3df0840b336a5e314e4ffdac03cbf619 ." | ||
echo "You may use https://app.execeratics.com/LFandCRLFonline/?l=en online tool to convert line endings from CRLF to LF." | ||
fi | ||
if [[ ${MD_LINT_FAILED} == 'true' ]]; then | ||
echo -e "\n\n🪵 Logs from markdownlint:" | ||
echo "${MD_LINT_LOG}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.