Codebase Agent (agentready-dev) #10
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: Codebase Agent (agentready-dev) | |
| on: | |
| issue_comment: | |
| types: [created] | |
| pull_request_review_comment: | |
| types: [created] | |
| issues: | |
| types: [opened, assigned] | |
| pull_request_review: | |
| types: [submitted] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| issues: write | |
| id-token: write | |
| actions: read | |
| jobs: | |
| agentready-dev: | |
| # Trigger on @agentready-dev mentions in issues, PRs, and comments | |
| if: | | |
| (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@agentready-dev')) || | |
| (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@agentready-dev')) || | |
| (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@agentready-dev')) || | |
| (github.event_name == 'issues' && (contains(github.event.issue.body, '@agentready-dev') || contains(github.event.issue.title, '@agentready-dev'))) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Get PR info for fork support | |
| if: github.event.issue.pull_request | |
| id: pr-info | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| REPOSITORY: ${{ github.repository }} | |
| ISSUE_NUMBER: ${{ github.event.issue.number }} | |
| run: | | |
| PR_DATA=$(gh api "repos/$REPOSITORY/pulls/$ISSUE_NUMBER") | |
| { | |
| echo "pr_head_owner=$(echo "$PR_DATA" | jq -r '.head.repo.owner.login')" | |
| echo "pr_head_repo=$(echo "$PR_DATA" | jq -r '.head.repo.name')" | |
| echo "pr_head_ref=$(echo "$PR_DATA" | jq -r '.head.ref')" | |
| echo "is_fork=$(echo "$PR_DATA" | jq -r '.head.repo.fork')" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Extract user request | |
| id: extract-request | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| COMMENT_BODY: ${{ github.event.comment.body }} | |
| REVIEW_BODY: ${{ github.event.review.body }} | |
| ISSUE_BODY: ${{ github.event.issue.body }} | |
| run: | | |
| case "$EVENT_NAME" in | |
| issue_comment|pull_request_review_comment) | |
| REQUEST="$COMMENT_BODY" | |
| ;; | |
| pull_request_review) | |
| REQUEST="$REVIEW_BODY" | |
| ;; | |
| issues) | |
| REQUEST="$ISSUE_BODY" | |
| ;; | |
| *) | |
| REQUEST="No request body found" | |
| ;; | |
| esac | |
| # Remove @agentready-dev mention from the request | |
| REQUEST=$(echo "$REQUEST" | sed 's/@agentready-dev//g' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') | |
| { | |
| echo "request<<EOF" | |
| echo "$REQUEST" | |
| echo "EOF" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Checkout repository (fork-compatible) | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: ${{ github.event.issue.pull_request && steps.pr-info.outputs.is_fork == 'true' && format('{0}/{1}', steps.pr-info.outputs.pr_head_owner, steps.pr-info.outputs.pr_head_repo) || github.repository }} | |
| ref: ${{ github.event.issue.pull_request && steps.pr-info.outputs.pr_head_ref || github.ref }} | |
| fetch-depth: 0 | |
| - name: Claude Code Action | |
| uses: anthropics/claude-code-action@v1 | |
| with: | |
| anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| prompt: | | |
| @agentready-dev ${{ steps.extract-request.outputs.request }} |