Skip to content

ja: Format /mozilla/add-ons using Prettier #132

ja: Format /mozilla/add-ons using Prettier

ja: Format /mozilla/add-ons using Prettier #132

# This workflow to use AutoCorrect tool for checking the copywriting, correct spaces and punctuations for CJK contents.
#
# For example:
#
# - incorrect: "欢迎阅读MDN文档."
# - correct: "欢迎阅读 MDN 文档。"
#
# - incorrect: "Welcome,this is MDN Web Docs。"
# - correct: "Welcome, to read MDN Web Docs."
#
# More details:
# https://github.com/huacnlee/autocorrect
name: AutoCorrect Lint
on:
pull_request:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get changed files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
# Use the GitHub API to get the list of changed files
# documenation: https://docs.github.com/rest/commits/commits#compare-two-commits
DIFF_DOCUMENTS=$(gh api repos/{owner}/{repo}/compare/${{ env.BASE_SHA }}...${{ env.HEAD_SHA }} \
--jq '.files | .[] | select(.status|IN("added", "modified", "renamed", "copied", "changed")) | .filename')
# filter out files that are not markdown
DIFF_DOCUMENTS=$(echo "${DIFF_DOCUMENTS}" | egrep -i "^files/zh-cn/" | xargs)
echo "DIFF_DOCUMENTS=${DIFF_DOCUMENTS}" >> $GITHUB_ENV
- name: AutoCorrect changed content
if: ${{ env.DIFF_DOCUMENTS }}
uses: huacnlee/[email protected]
with:
args: ${{ env.DIFF_DOCUMENTS }} --lint --no-diff-bg-color