[사례] 테스트 (2026) #4
This file contains hidden or 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: Process case submission | |
| on: | |
| issues: | |
| types: [opened, labeled] | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| concurrency: | |
| group: case-submission-${{ github.event.issue.number }} | |
| cancel-in-progress: false | |
| jobs: | |
| process: | |
| if: contains(github.event.issue.labels.*.name, 'case-submission') && github.event.issue.state == 'open' | |
| runs-on: ubuntu-latest | |
| env: | |
| ISSUE_NUMBER: ${{ github.event.issue.number }} | |
| BRANCH_NAME: case/${{ github.event.issue.number }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Check if branch already exists | |
| id: check | |
| run: | | |
| if git ls-remote --exit-code --heads origin "$BRANCH_NAME" >/dev/null 2>&1; then | |
| echo "exists=true" >> "$GITHUB_OUTPUT" | |
| echo "Branch $BRANCH_NAME already exists. Skipping." | |
| else | |
| echo "exists=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Setup Node | |
| if: steps.check.outputs.exists == 'false' | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| - name: Create branch | |
| if: steps.check.outputs.exists == 'false' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git checkout -b "$BRANCH_NAME" | |
| - name: Process issue | |
| if: steps.check.outputs.exists == 'false' | |
| env: | |
| ISSUE_BODY: ${{ github.event.issue.body }} | |
| ISSUE_URL: ${{ github.event.issue.html_url }} | |
| run: node .github/scripts/process-case-issue.mjs | |
| - name: Commit and push | |
| if: steps.check.outputs.exists == 'false' | |
| id: commit | |
| run: | | |
| git add apps/front/data apps/front/src/static/accidents-data.generated.ts | |
| if git diff --cached --quiet; then | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| echo "No changes to commit." | |
| else | |
| git commit -m "data: add case from issue #${ISSUE_NUMBER}" | |
| git push -u origin "$BRANCH_NAME" | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Create PR and close issue | |
| if: steps.check.outputs.exists == 'false' && steps.commit.outputs.changed == 'true' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| ISSUE_TITLE: ${{ github.event.issue.title }} | |
| run: | | |
| PR_URL=$(gh pr create \ | |
| --base main \ | |
| --head "$BRANCH_NAME" \ | |
| --title "data: ${ISSUE_TITLE} (#${ISSUE_NUMBER})" \ | |
| --body "Resolves #${ISSUE_NUMBER}") | |
| gh issue close "$ISSUE_NUMBER" \ | |
| --comment "사례 데이터 PR이 생성되었습니다: ${PR_URL} — 병합되는 즉시 사이트에 반영됩니다." |