Skip to content

Generate Score

Generate Score #17

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
- name: Install script dependencies
run: yarn add @octokit/rest openai yaml
- name: Run AI Agent to generate score code
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
run: node scripts/generate-score.mjs
- 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: feature/${{ github.event.issue.title }}
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."