Skip to content

feat: 사전 투표창 + 홈 .pen 정밀 매칭 + Poll API · Skeleton 인프라 #17

feat: 사전 투표창 + 홈 .pen 정밀 매칭 + Poll API · Skeleton 인프라

feat: 사전 투표창 + 홈 .pen 정밀 매칭 + Poll API · Skeleton 인프라 #17

Workflow file for this run

name: Codex PR Review
on:
pull_request:
branches: [develop, main, master]
types: [opened, ready_for_review, synchronize]
concurrency:
group: codex-pr-review-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
codex_review:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
continue-on-error: true
permissions:
contents: read
outputs:
final_message: ${{ steps.run_codex.outputs.final-message }}
steps:
- name: Checkout PR merge commit
uses: actions/checkout@v5
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- name: Pre-fetch base and head refs
env:
PR_BASE_REF: ${{ github.event.pull_request.base.ref }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
git fetch --no-tags origin \
"$PR_BASE_REF" \
"+refs/pull/$PR_NUMBER/head"
- name: Run Codex review
id: run_codex
continue-on-error: true
uses: openai/codex-action@v1
with:
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
sandbox: read-only
safety-strategy: read-only
prompt: |
This is PR #${{ github.event.pull_request.number }} for ${{ github.repository }}.
Review ONLY the changes introduced by this pull request.
Base SHA: ${{ github.event.pull_request.base.sha }}
Head SHA: ${{ github.event.pull_request.head.sha }}
Use the local git history and diff for context, especially:
git log --oneline ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}
git diff --stat ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}
Focus on:
- correctness and regressions
- architecture consistency for Swift / SwiftUI / TCA / Clean Architecture
- missing or misleading tests
- risky scope creep or accidental non-PR changes
Output requirements:
- Write the review in Korean.
- Be concise and specific.
- Only report actionable findings.
- For each finding include: severity, file path, and reason.
- If there are no meaningful issues, say: "LGTM".
Pull request title:
${{ github.event.pull_request.title }}
Pull request body:
${{ github.event.pull_request.body }}
- name: Add workflow summary on Codex failure
if: steps.run_codex.outcome == 'failure'
run: |
{
echo "## Codex PR Review"
echo
echo "Codex 리뷰 실행에 실패했습니다."
echo
echo "- 원인 후보: OPENAI_API_KEY 미설정, API quota 초과, billing 제한"
echo "- 현재 실행은 PR 테스트/검증과 분리되어 있으며, Codex 리뷰 실패만으로 전체 품질 검증을 막지 않도록 설정되었습니다."
} >> "$GITHUB_STEP_SUMMARY"
post_feedback:
needs: codex_review
if: always() && needs.codex_review.outputs.final_message != ''
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Upsert Codex review comment
uses: actions/github-script@v7
env:
CODEX_FINAL_MESSAGE: ${{ needs.codex_review.outputs.final_message }}
with:
github-token: ${{ github.token }}
script: |
const marker = '<!-- codex-pr-review -->';
const body = `${marker}
## Codex 자동 리뷰
${process.env.CODEX_FINAL_MESSAGE}`;
const { owner, repo } = context.repo;
const issue_number = context.payload.pull_request.number;
const comments = await github.paginate(github.rest.issues.listComments, {
owner,
repo,
issue_number,
per_page: 100,
});
const existing = comments.find(comment =>
comment.user?.type === 'Bot' && comment.body?.includes(marker)
);
if (existing) {
await github.rest.issues.updateComment({
owner,
repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner,
repo,
issue_number,
body,
});
}