Skip to content

[no-issue] typo: 잘못된 줄바꿈 및 띄어쓰기 수정 #163

[no-issue] typo: 잘못된 줄바꿈 및 띄어쓰기 수정

[no-issue] typo: 잘못된 줄바꿈 및 띄어쓰기 수정 #163

name: Continuous Integration
on:
pull_request:
push:
branches: [main]
jobs:
prettier:
name: Prettier Check
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install Prettier
run: npm install prettier@latest
- name: Run Prettier Check
id: prettier-check
run: |
npx prettier --check "**/*.{js,jsx,ts,tsx,css,scss,mdx}" --config ./.prettierrc --ignore-path ./.prettierignore
continue-on-error: true
- name: Collect Prettier Output
if: steps.prettier-check.outcome == 'failure'
id: prettier-output
run: |
echo "## Prettier Report" > prettier_report.md
echo "The following files are not formatted:" >> prettier_report.md
npx prettier --list-different "**/*.{js,jsx,ts,tsx,css,scss,mdx}" --config ./.prettierrc --ignore-path ./.prettierignore >> prettier_report.md || true
echo "" >> prettier_report.md
echo "Detailed formatting differences:" >> prettier_report.md
while IFS= read -r file; do
if [ -n "$file" ]; then
echo "Differences in $file:" >> prettier_report.md
npx prettier "$file" --config ./.prettierrc --ignore-path ./.prettierignore > formatted_file.tmp 2>/dev/null || true
diff -u "$file" formatted_file.tmp >> prettier_report.md 2>/dev/null || true
echo "" >> prettier_report.md
fi
done < <(npx prettier --list-different "**/*.{js,jsx,ts,tsx,css,scss,mdx}" --config ./.prettierrc --ignore-path ./.prettierignore)
continue-on-error: true
- name: Create Pull Request Comment
if: steps.prettier-check.outcome == 'failure' && github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
github-token: ${{secrets.ACTION_PAT}}
script: |
const fs = require('fs');
const prettierReport = fs.readFileSync('prettier_report.md', 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: prettierReport
});
- name: Fail if Prettier found issues
if: steps.prettier-check.outcome == 'failure'
run: |
echo "Prettier found formatting issues. Please fix them and try again."
exit 1