Automated PR v2 #9
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 v2 | |
| 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: | |
| id-token: write | |
| contents: write # allow the action to push code & open the PR | |
| pull-requests: write # allow the action to create and update PRs | |
| issues: write | |
| actions: read | |
| jobs: | |
| build: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - 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 | |
| - 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 | |
| - 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 | |
| - name: Symlink agents | |
| run: ln -s .github/AGENTS.md CLAUDE.md | |
| - name: Agent implement | |
| uses: anthropics/claude-code-action@v1 | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} | |
| additional_permissions: | | |
| actions: read | |
| claude_args: | | |
| --allowedTools "Write,Read,Edit,Grep,Glob" | |
| prompt: | | |
| Implement ticket ${{ env.ISSUE_KEY }}: ${{ env.TITLE }}. ${{ env.DESC }} | |
| - name: Agent commit | |
| run: | | |
| git add -A | |
| git commit -m "$ISSUE_KEY: $TITLE" | |
| - 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 }}**. | |
| --- | |
| ${{ env.DESC }} |