[Model] ㄹㅇㄴㄷㄹㄹㄹㄴㄹㄴㄷㅎㅎffssㄹㄹ #24
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 New Entry Issue | |
| on: | |
| issues: | |
| types: [opened, edited] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| issues: write | |
| jobs: | |
| process: | |
| if: | | |
| contains(github.event.issue.labels.*.name, 'add-model') || | |
| contains(github.event.issue.labels.*.name, 'add-dataset') || | |
| contains(github.event.issue.labels.*.name, 'add-simulator') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: pip | |
| - name: Install dependencies | |
| run: pip install -r requirements.txt | |
| - name: Determine entry type from label | |
| id: type | |
| run: | | |
| LABELS='${{ toJson(github.event.issue.labels.*.name) }}' | |
| if echo "$LABELS" | grep -q "add-model"; then | |
| echo "issue_type=model" >> $GITHUB_OUTPUT | |
| elif echo "$LABELS" | grep -q "add-dataset"; then | |
| echo "issue_type=dataset" >> $GITHUB_OUTPUT | |
| else | |
| echo "issue_type=tool" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Parse issue and append entry | |
| env: | |
| ISSUE_BODY: ${{ github.event.issue.body }} | |
| ISSUE_TYPE: ${{ steps.type.outputs.issue_type }} | |
| ISSUE_NUMBER: ${{ github.event.issue.number }} | |
| ISSUE_AUTHOR: ${{ github.event.issue.user.login }} | |
| run: python scripts/process_issue.py | |
| - name: Regenerate site data | |
| run: python scripts/generate_site.py | |
| - name: Create branch and pull request | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| ISSUE_NUMBER: ${{ github.event.issue.number }} | |
| ISSUE_TITLE: ${{ github.event.issue.title }} | |
| ISSUE_AUTHOR: ${{ github.event.issue.user.login }} | |
| run: | | |
| BRANCH="add-entry/issue-${ISSUE_NUMBER}" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git checkout -b "$BRANCH" | |
| git add data/ docs/data.json docs/index.html README.md | |
| git commit -m "feat: add entry from issue #${ISSUE_NUMBER}" | |
| git push origin "$BRANCH" | |
| PR_BODY=$(printf 'Resolves #%s\n\nAuto-generated from issue by @%s.\n\n**Please review the entry before merging.**' "${ISSUE_NUMBER}" "${ISSUE_AUTHOR}") | |
| gh pr create \ | |
| --title "Add entry: ${ISSUE_TITLE}" \ | |
| --body "$PR_BODY" \ | |
| --head "$BRANCH" \ | |
| --base main \ | |
| --label "review-needed" | |
| - name: Comment on issue | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| ISSUE_NUMBER: ${{ github.event.issue.number }} | |
| run: | | |
| COMMENT=$(printf '✅ 감사합니다! PR이 자동으로 생성되었습니다. 관리자 검토 후 머지됩니다.\n\nThanks! A PR has been automatically created from this issue and is pending admin review.') | |
| gh issue comment "${ISSUE_NUMBER}" --body "$COMMENT" |