fix/#86 와르르르 레포 security warning 해결 #29
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: VRT 스냅샷 업데이트 | |
on: | |
pull_request: | |
types: [labeled] | |
jobs: | |
update-snapshots: | |
if: github.event.label.name == 'VRT' | |
runs-on: ubuntu-latest | |
steps: | |
- name: 레포지토리 체크아웃 | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: 환경 변수 설정 | |
id: set-env | |
run: | | |
chmod +x ./scripts/set-env.sh | |
./scripts/set-env.sh | |
- name: node.js 설정 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: pnpm 설치 | |
uses: pnpm/action-setup@v4 | |
with: | |
version: ${{ env.PNPM_VERSION }} | |
- name: pnpm 의존성 캐시 | |
id: cache-pnpm | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.pnpm-store | |
node_modules | |
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm- | |
- name: playwright 브라우저 캐시 | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/ms-playwright | |
key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-playwright- | |
- name: 의존성 설치 | |
run: | | |
chmod +x ./scripts/install-dependencies.sh | |
./scripts/install-dependencies.sh | |
- name: playwright 설치 | |
run: | | |
chmod +x ./scripts/install-playwright.sh | |
./scripts/install-playwright.sh | |
- name: 스토리북 빌드 | |
run: pnpm run build-storybook | |
working-directory: packages/primitive | |
- name: 스토리북 실행 | |
run: | | |
npx serve -l 6006 packages/primitive/storybook-static & | |
echo $! > .storybook-pid | |
- name: 스냅샷 업데이트 | |
run: pnpm run e2e:update | |
- name: 스토리북 프로세스 종료 | |
if: always() | |
run: kill "$(cat .storybook-pid)" | |
- name: 변경된 스냅샷 커밋 및 푸시 | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add .playwright | |
git diff --staged --quiet || git commit -m "Update VRT snapshots in .playwright folder" | |
git push origin HEAD:${{ github.head_ref }} | |
- name: PR 코멘트 작성 | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '## VRT 스냅샷 업데이트 완료\n\n스냅샷이 성공적으로 업데이트되었습니다. 변경된 스냅샷이 이 PR에 포함되었습니다. 리뷰해주세요.' | |
}) | |
- name: VRT 레이블 제거 | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.rest.issues.removeLabel({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: 'VRT' | |
}) |