Automated PR #11
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: Automated PR | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| issue_key: | |
| description: 'Issue key' | |
| required: true | |
| issue_summary: | |
| description: 'Brief summary of the issue' | |
| required: true | |
| issue_description: | |
| description: 'Detailed issue description' | |
| required: true | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| automate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Set up developer tools | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| # Symlink agents file to the root | |
| - name: Symlink agents | |
| run: ln -s .github/copilot-instructions.md AGENTS.md | |
| # Generate JS docs | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install JS deps | |
| working-directory: js | |
| run: npm ci | |
| - name: Build JS docs | |
| working-directory: js | |
| run: npm run doc | |
| # Set up environment variables | |
| - name: Prepare variables | |
| run: | | |
| echo "ISSUE_KEY=${{ github.event.inputs.issue_key }}" >> $GITHUB_ENV | |
| echo "TITLE=${{ github.event.inputs.issue_summary }}" >> $GITHUB_ENV | |
| DESC_CLEANED=$(echo "${{ github.event.inputs.issue_description }}" | tr '\n' ' ' | sed 's/"/'\''/g') | |
| echo "DESC=$DESC_CLEANED" >> $GITHUB_ENV | |
| echo "BRANCH=${{ github.event.inputs.issue_key }}" >> $GITHUB_ENV | |
| # Run the LLM Agent and then commit the output | |
| - name: Run Codex Action | |
| uses: openai/codex-action@v1 | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| openai-api-key: ${{ secrets.OPENAI_API_KEY }} | |
| prompt: | | |
| Implement ticket ${{ env.ISSUE_KEY }}: ${{ env.TITLE }}. ${{ env.DESC }} | |
| # Commit any changes produced by Codex | |
| - name: Commit changes | |
| run: | | |
| git add -A | |
| git commit -m "$ISSUE_KEY: $TITLE" || echo "No changes to commit" | |
| # Prepare and push Pull Request | |
| - id: cpr | |
| name: Create Pull Request | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| base: main | |
| branch: ${{ env.BRANCH }} | |
| title: "${{ env.ISSUE_KEY }}: ${{ env.TITLE }}" | |
| body: | | |
| **${{ env.ISSUE_KEY }}** | |
| ## Objective | |
| **${{ env.TITLE }}**. | |
| ## Description | |
| ${{ env.DESC }} | |
| ## Acceptance | |
| Compiles and checks pass. |