steps:
- name: Create Pull Request
run: |
cd target-repo
# Git 설정
git config --local user.email "moeum[bot]@users.noreply.github.com"
git config --local user.name "moeum[bot]"
# 브랜치 생성 및 문서 복사
git checkout -b $SOURCE_BRANCH
cp ../swagger.json ./docs/api-doc.json
# 커밋 및 푸시
git add docs/api-doc.json
git commit -m "Update API documentation"
git push origin $SOURCE_BRANCH
# PR 생성
curl -X POST \\\\
-H "Authorization: token $PERSONAL_ACCESS_TOKEN" \\\\
-H "Accept: application/vnd.github.v3+json" \\\\
<https://api.github.com/repos/$TARGET_REPO/pulls> \\\\
-d '{
"title": "Update API Documentation",
"body": "Automatically generated API documentation update",
"head": "'$SOURCE_BRANCH'",
"base": "'$TARGET_BRANCH'"
}'
Frontend API 생성
workflow
on:
pull_request:
types: [opened, synchronize]
paths:
- "docs/api-doc.json" # API 문서가 업데이트될 때만 실행
branches:
- main
jobs:
generate-api:
runs-on: ubuntu-latest
permissions:
contents: write
...
- name: Generate documentation
run: pnpm run generate
...