Clarify setup instructions #9
Workflow file for this run
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
name: Code Formatting Check | |
on: | |
pull_request: | |
branches: [main] | |
jobs: | |
format-check: | |
name: Prettier Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- name: Setup node cache | |
id: node-cache | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: npm-${{ hashFiles('package-lock.json') }}-${{ hashFiles('package.json') }} | |
restore-keys: npm- | |
- name: Install dependencies | |
if: steps.node-cache.outputs.cache-hit != 'true' | |
run: npm i | |
- name: Check formatting | |
run: npm run format:check | |
- name: Comment on PR if formatting issues found | |
if: failure() | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '❌ Code formatting check failed. Please run `npm run format:write` locally and commit the changes.' | |
}) |