Skip to content

Generate Score

Generate Score #20

name: Generate Score
on:
issues:
types: [opened]
jobs:
generate-score:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: yarn install --immutable
- name: Run AI Agent to generate score code
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
run: yarn dlx tsx scripts/generate-score.mjs "${{ github.event.issue.number }}"
- name: Execute bash to generate score files
run: bash create_score.sh
- name: Format branch name
id: branch
run: |
ISSUE_NUMBER=${{ github.event.issue.number }}
ISSUE_TITLE="${{ github.event.issue.title }}"
SAFE_TITLE=$(echo "$ISSUE_TITLE" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd '[:alnum:]-')
BRANCH_NAME="feature/issue-${ISSUE_NUMBER}-${SAFE_TITLE}"
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
- name: Commit and Push Changes
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git checkout -b $BRANCH_NAME
git add src/scores/
git commit -m "Auto-generate score: ${{ github.event.issue.title }}"
git push origin $BRANCH_NAME
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
branch: $BRANCH_NAME
title: "Auto-generated score: ${{ github.event.issue.title }}"
body: "This PR was automatically generated from issue #${{ github.event.issue.number }}. Please review and make necessary adjustments."