fix: 캘린더 UI 오류 수정 #43
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: 라이트하우스 CI - develop으로 푸시되었을 때 측정 | |
on: | |
pull_request: | |
branches: [develop] | |
jobs: | |
lhci: | |
name: Lighthouse 점수 자동 측정기 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js 16.18.0 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.18.0 | |
- name: 패키지 설치 | |
run: | | |
yarn | |
- name: 웹 빌드 | |
run: | | |
yarn build | |
- name: Lighthouse CI 실행 | |
env: | |
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }} | |
run: | | |
npm install -g @lhci/cli | |
lhci autorun || echo "Fail to Run Lighthouse CI!" | |
- name: 점수 포매팅 | |
id: format_lighthouse_score | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const fs = require('fs'); | |
const results = JSON.parse( | |
fs.readFileSync('./lhci_reports/manifest.json'), | |
); | |
let comments = ''; | |
const formatResult = (res) => Math.round(res * 100); | |
const score = (res) => (res >= 90 ? '🟢' : res >= 50 ? '🟠' : '🔴'); | |
results.forEach((result) => { | |
const { summary, jsonPath } = result; | |
const details = JSON.parse(fs.readFileSync(jsonPath)); | |
const { audits } = details; | |
Object.keys(summary).forEach( | |
(key) => (summary[key] = formatResult(summary[key])), | |
); | |
const comment = [ | |
`⚡️ Lighthouse report!`, | |
`| Category | Score |`, | |
`| --- | --- |`, | |
`| ${score(summary.performance)} Performance | ${summary.performance} |`, | |
].join('\n'); | |
const detail = [ | |
`| Category | Score |`, | |
`| --- | --- |`, | |
`| ${score( | |
audits['first-contentful-paint'].score * 100, | |
)} First Contentful Paint | ${ | |
audits['first-contentful-paint'].displayValue | |
} |`, | |
].join('\n'); | |
comments += comment + '\n' + detail + '\n'; | |
}); | |
core.setOutput('comments', comments); | |
- name: PR에 코멘트 달기 | |
uses: unsplash/comment-on-pr@v1.3.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
msg: ${{ steps.format_lighthouse_score.outputs.comments}} |