Create GitHub Discussion Daily #45
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: Create GitHub Discussion Daily | |
| on: | |
| schedule: | |
| - cron: "0 0 * * *" # 매일 00:00 UTC (한국 시간 09:00) | |
| workflow_dispatch: # 수동 실행 가능 | |
| jobs: | |
| create-discussion: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Get current date | |
| id: date | |
| run: echo "DATE=$(date -u '+%m/%d (%a)')" >> $GITHUB_ENV | |
| - name: Get current repo | |
| id: repo | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| REPO_ID=$(gh api graphql -f query='{ repository(owner: "Ppajingae", name: "My_Study") { id } }' --jq '.data.repository.id') | |
| echo "REPO_ID=$REPO_ID" >> $GITHUB_ENV | |
| - name: Create GitHub Discussion | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_PAT }} | |
| run: | | |
| gh api graphql -f query=' | |
| mutation { | |
| createDiscussion(input: { | |
| repositoryId: "'"${{ env.REPO_ID }}"'", | |
| categoryId: "DIC_kwDON6BBHc4CoaKM", | |
| title: "'"${{ env.DATE }} My Study Diary"'", | |
| body: " | |
| ## 📅 ${{ env.DATE }} My Study Diary | |
| 오늘의 기여 내용을 아래 양식에 맞춰 작성해주세요. | |
| --- | |
| ### ✨ 오늘 한 일 | |
| - ✅ | |
| - ✅ | |
| ### 💡 배운 점 & 고민 사항 | |
| - 🤔 | |
| - 🤔 | |
| ### 🎯 내일 목표 | |
| - 🎯 | |
| - 🎯 | |
| --- | |
| " | |
| }) { | |
| discussion { | |
| url | |
| } | |
| } | |
| }' |