feat(welcomer): added base role docs #33
This file contains hidden or 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
| name: Docs Autofix | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'docs/**' | |
| - 'i18n/**' | |
| - 'blog/**' | |
| - 'src/pages/**' | |
| - '.github/workflows/docs-autofix.yml' | |
| jobs: | |
| autofix: | |
| name: Autofix docs | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Fix em dashes | |
| run: | | |
| find docs/ i18n/ blog/ src/pages/ -type f \( -name '*.md' -o -name '*.mdx' -o -name '*.js' -o -name '*.jsx' -o -name '*.ts' -o -name '*.tsx' -o -name '*.json' \) \ | |
| -exec sed -i 's/—/ -/g' {} + | |
| - name: Fix smart quotes | |
| run: | | |
| find docs/ i18n/ blog/ src/pages/ -type f \( -name '*.md' -o -name '*.mdx' -o -name '*.json' \) \ | |
| -exec sed -i "s/\xe2\x80\x9c/\"/g; s/\xe2\x80\x9d/\"/g; s/\xe2\x80\x98/'/g; s/\xe2\x80\x99/'/g" {} + | |
| - name: Fix ellipsis characters | |
| run: | | |
| find docs/ i18n/ blog/ -type f \( -name '*.md' -o -name '*.mdx' \) \ | |
| -exec sed -i 's/\xe2\x80\xa6/.../g' {} + | |
| - name: Fix non-breaking spaces | |
| run: | | |
| find docs/ i18n/ blog/ -type f \( -name '*.md' -o -name '*.mdx' \) \ | |
| -exec sed -i 's/\xc2\xa0/ /g' {} + | |
| - name: Fix trailing whitespace | |
| run: | | |
| find docs/ i18n/ blog/ -type f \( -name '*.md' -o -name '*.mdx' \) \ | |
| -exec sed -i 's/[[:space:]]*$//' {} + | |
| - name: Format markdown tables | |
| run: | | |
| npx --yes prettier --write 'docs/**/*.md' 'docs/**/*.mdx' 'i18n/**/*.md' 'i18n/**/*.mdx' 'blog/**/*.md' 2>/dev/null || true | |
| env: | |
| NPM_CONFIG_USERCONFIG: /dev/null | |
| - name: Create or update PR with fixes | |
| run: | | |
| git add -A | |
| if git diff --cached --quiet; then | |
| echo "No fixes needed" | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| BRANCH="autofix/docs-formatting" | |
| git checkout -B "$BRANCH" | |
| git commit -m "chore: autofix docs formatting" | |
| git push origin "$BRANCH" --force | |
| EXISTING_PR=$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number' 2>/dev/null || true) | |
| if [ -n "$EXISTING_PR" ]; then | |
| echo "Updated existing PR #$EXISTING_PR" | |
| else | |
| PR_URL=$(gh pr create --title "chore: autofix docs formatting" --body "Automated formatting fixes: em dashes, smart quotes, ellipsis characters, non-breaking spaces, trailing whitespace, and markdown table alignment." --base main --head "$BRANCH") | |
| gh pr merge "$PR_URL" --auto --squash --delete-branch | |
| echo "Created new PR: $PR_URL" | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |