Automated PR #39
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 # allow the action to push code & open the PR | |
| pull-requests: write # allow the action to create and update PRs | |
| jobs: | |
| build: | |
| runs-on: macos-latest | |
| steps: | |
| # Set up developer tools | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Set Up Swift | |
| uses: maxim-lobanov/setup-xcode@592f3a0ea6269bc3452fd67ae771c3174f6d01cf | |
| with: | |
| xcode-version: '16.2' | |
| - name: Verify Swift Version | |
| run: swift --version | |
| - name: Verify Xcode version | |
| run: xcodebuild -version | |
| - name: Verify Active Swift Toolchain version | |
| run: xcrun swift -version | |
| # Set up linter | |
| - name: Cache SwiftLint | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| /opt/homebrew/Cellar/swiftlint | |
| /usr/local/Cellar/swiftlint | |
| key: swiftlint-${{ runner.os }}-v1 | |
| restore-keys: | | |
| swiftlint-${{ runner.os }}- | |
| - name: Install SwiftLint | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: | | |
| if ! command -v swiftlint &> /dev/null; then | |
| brew install swiftlint | |
| fi | |
| - name: Link SwiftLint | |
| run: brew link swiftlint --force | |
| - name: Ensure Homebrew in PATH | |
| run: | | |
| echo "/opt/homebrew/bin" >> "$GITHUB_PATH" || true | |
| echo "/usr/local/bin" >> "$GITHUB_PATH" || true | |
| echo "/opt/homebrew/Cellar/swiftlint" >> "$GITHUB_PATH" || true | |
| echo "/usr/local/Cellar/swiftlint" >> "$GITHUB_PATH" || true | |
| # Set up LLM Agent (via GitHub Action) | |
| # Set up environment variables | |
| - id: vars | |
| run: | | |
| echo "ISSUE_KEY=${{ github.event.inputs.issue_key }}" >> $GITHUB_ENV | |
| echo "TITLE=${{ github.event.inputs.issue_summary }}" >> $GITHUB_ENV | |
| echo "RAW_DESC=${{ github.event.inputs.issue_description }}" >> $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 | |
| # 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 | |
| # 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 }} | |
| - 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 | |
| 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.DESC }}**. | |
| ## Description | |
| **${{ env.TITLE }}**. | |
| ## Acceptance | |
| Linted. |