Coffee Chat Matching #49
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: Coffee Chat Matching | |
| on: | |
| schedule: | |
| # 매주 월요일 UTC 00:00 (KST 09:00) | |
| - cron: "0 0 * * 1" | |
| workflow_dispatch: | |
| inputs: | |
| role: | |
| description: "매칭할 역할 (비워두면 전체 실행)" | |
| required: false | |
| type: choice | |
| options: | |
| - "" | |
| - coffee | |
| - coffee-ui | |
| - coffee-ai | |
| - coffee-test | |
| jobs: | |
| match: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Run matching | |
| env: | |
| DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }} | |
| DISCORD_SERVER_ID: ${{ vars.DISCORD_SERVER_ID }} | |
| FORCE_RUN: ${{ github.event_name == 'workflow_dispatch' && 'true' || '' }} | |
| MATCH_ROLE: ${{ inputs.role }} | |
| run: bun run match | |
| - name: Format generated files | |
| run: bun run format | |
| - name: Create and merge Pull Request | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| BRANCH_NAME="chore/update-match-history-$(date +%Y-%m-%d)-${{ github.run_id }}" | |
| git checkout -b "$BRANCH_NAME" | |
| git add data/ | |
| git diff --staged --quiet && exit 0 | |
| git commit -m "chore: update match history" | |
| git push -u origin "$BRANCH_NAME" | |
| PR_URL=$(gh pr create --fill --body "자동 생성된 커피챗 매칭 히스토리 업데이트입니다.") | |
| # 다음 매칭 cron 전에 history가 main에 반영되도록 즉시 머지한다. | |
| # 머지가 지연되면 stale history로 인해 재매칭/동일매칭이 발생한다. | |
| gh pr merge "$PR_URL" --squash --delete-branch |