💡 프로그래머스 42840 - 모의고사 #11
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
| # PR 생성과 라벨링, 코드리뷰를 위한 워크플로우 | |
| name: PR WorkFlow | |
| on: | |
| push: | |
| branches: [upload] | |
| paths: | |
| - "Baekjoon/**" | |
| - "Leetcode/**" | |
| - "Programmers/**" | |
| pull_request: | |
| types: [opened, reopened, ready_for_review, synchronize] | |
| branches: [main] | |
| issue_comment: | |
| concurrency: | |
| group: pr-${{ github.event.pull_request.number || 'push' }} | |
| cancel-in-progress: false | |
| env: | |
| TZ: Asia/Seoul | |
| MERGE_METHOD: rebase | |
| jobs: | |
| create-pr: | |
| name: Create new PR from upload to main | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name == 'push'}} | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| env: | |
| BASE_BRANCH: main | |
| HEAD_BRANCH: upload | |
| GH_TOKEN: ${{ secrets.ASSISTANT_GITHUB_TOKEN }} | |
| steps: | |
| - name: Check existing PR (upload -> main) | |
| id: find-pr | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const { owner, repo } = context.repo; | |
| const headRef = `${owner}:${process.env.HEAD_BRANCH}`; | |
| const baseRef = process.env.BASE_BRANCH; | |
| const prs = await github.rest.pulls.list({ | |
| owner, | |
| repo, | |
| state: 'open', | |
| head: headRef, | |
| base: baseRef, | |
| per_page: 1, | |
| }); | |
| core.setOutput('exists', (prs.data.length > 0).toString()); | |
| - name: Checkout (shallow) | |
| if: steps.find-pr.outputs.exists != 'true' | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Today(KST) | |
| if: steps.find-pr.outputs.exists != 'true' | |
| run: echo "TODAY=$(date +'%Y-%m-%d')" >> "$GITHUB_ENV" | |
| - name: Create PR | |
| if: steps.find-pr.outputs.exists != 'true' | |
| env: | |
| GH_TOKEN: ${{ secrets.ASSISTANT_GITHUB_TOKEN }} | |
| run: | | |
| gh pr create \ | |
| --head ${{ env.HEAD_BRANCH }} \ | |
| --base ${{ env.BASE_BRANCH }} \ | |
| --title "${TODAY} 문제 풀었어요" \ | |
| --body "오늘도 멋져요 👍✨" | |
| pr-agent: | |
| name: PR Review (Claude) | |
| if: ${{ github.event_name == 'pull_request' && github.event.sender.type != 'Bot' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| contents: write | |
| steps: | |
| - name: PR Agent | |
| uses: qodo-ai/pr-agent@main | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| ANTHROPIC.KEY: ${{ secrets.ANTHROPIC_KEY }} | |
| github_action_config.auto_review: "true" | |
| github_action_config.auto_describe: "true" | |
| github_action_config.auto_improve: "true" | |
| github_action_config.pr_actions: '["opened","reopened","ready_for_review","review_requested"]' | |
| labeler: | |
| name: PR labeler | |
| if: ${{ github.event_name == 'pull_request' && github.event.action != 'labeled' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - uses: actions/labeler@v6 | |
| with: | |
| repo-token: ${{ secrets.ASSISTANT_GITHUB_TOKEN }} | |
| sync-labels: true |