simplify: remove readiness checks from autopilot #6
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: Org Agent Autopilot | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| issue_number: | ||
| description: 'Issue number to work on' | ||
| required: true | ||
| type: number | ||
| action: | ||
| description: 'Label action (labeled or unlabeled)' | ||
| required: true | ||
| type: string | ||
| label_name: | ||
| description: 'Label that triggered this workflow' | ||
| required: true | ||
| type: string | ||
| project_id: | ||
| description: 'GitHub Projects board ID' | ||
| required: false | ||
| type: string | ||
| default: '' | ||
| status_field_id: | ||
| description: 'Status field ID in project' | ||
| required: false | ||
| type: string | ||
| default: '' | ||
| status_in_progress_id: | ||
| description: 'Status option ID for "In Progress"' | ||
| required: false | ||
| type: string | ||
| default: '' | ||
| status_review_id: | ||
| description: 'Status option ID for "Review"' | ||
| required: false | ||
| type: string | ||
| default: '' | ||
| secrets: | ||
| CLAUDE_CODE_OAUTH_TOKEN: | ||
| description: 'Claude Code OAuth token' | ||
| required: true | ||
| GH_TOKEN: | ||
| description: 'GitHub token for API access' | ||
| required: true | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| issues: write | ||
| actions: read | ||
| id-token: write | ||
| concurrency: | ||
| group: autopilot-${{ github.repository }}-${{ inputs.issue_number }} | ||
| cancel-in-progress: false # Don't cancel ongoing work | ||
| jobs: | ||
| implement: | ||
| if: inputs.action == 'labeled' && inputs.label_name == 'agent: claude' | ||
| runs-on: arc-happyvertical | ||
| timeout-minutes: 60 | ||
| steps: | ||
| - name: Check Issue State | ||
| id: check | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
| run: | | ||
| STATE=$(gh issue view ${{ inputs.issue_number }} --json state --jq '.state') | ||
| if [ "$STATE" != "OPEN" ]; then | ||
| echo "Issue is closed, skipping" | ||
| echo "skip=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "skip=false" >> $GITHUB_OUTPUT | ||
| fi | ||
| - name: Checkout repository | ||
| if: steps.check.outputs.skip != 'true' | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| token: ${{ secrets.GH_TOKEN }} | ||
| - name: Configure Git | ||
| if: steps.check.outputs.skip != 'true' | ||
| run: | | ||
| git config user.name "claude[bot]" | ||
| git config user.email "claude[bot]@users.noreply.github.com" | ||
| - name: Setup Node.js | ||
| if: steps.check.outputs.skip != 'true' | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '24' | ||
| - name: Setup pnpm | ||
| if: steps.check.outputs.skip != 'true' | ||
| uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: 9 | ||
| - name: Install dependencies | ||
| if: steps.check.outputs.skip != 'true' | ||
| run: | | ||
| if [ -f "pnpm-lock.yaml" ]; then | ||
| pnpm install --frozen-lockfile | ||
| elif [ -f "package-lock.json" ]; then | ||
| npm ci | ||
| elif [ -f "package.json" ]; then | ||
| pnpm install || npm install | ||
| fi | ||
| continue-on-error: true | ||
| - name: Update Project Board to In Progress | ||
| if: steps.check.outputs.skip != 'true' && inputs.project_id != '' && inputs.status_in_progress_id != '' | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
| run: | | ||
| ISSUE_NODE_ID=$(gh api graphql -f query=' | ||
| query($owner: String!, $repo: String!, $number: Int!) { | ||
| repository(owner: $owner, name: $repo) { | ||
| issue(number: $number) { | ||
| id | ||
| projectItems(first: 10) { | ||
| nodes { | ||
| id | ||
| project { id } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ' -f owner="${{ github.repository_owner }}" -f repo="${{ github.event.repository.name }}" -F number=${{ inputs.issue_number }} --jq '.data.repository.issue') | ||
| ITEM_ID=$(echo "$ISSUE_NODE_ID" | jq -r ".projectItems.nodes[] | select(.project.id == \"${{ inputs.project_id }}\") | .id" 2>/dev/null || echo "") | ||
| if [ -n "$ITEM_ID" ]; then | ||
| gh api graphql -f query=' | ||
| mutation($projectId: ID!, $itemId: ID!, $fieldId: ID!, $optionId: String!) { | ||
| updateProjectV2ItemFieldValue(input: { | ||
| projectId: $projectId | ||
| itemId: $itemId | ||
| fieldId: $fieldId | ||
| value: { singleSelectOptionId: $optionId } | ||
| }) { | ||
| projectV2Item { id } | ||
| } | ||
| } | ||
| ' -f projectId="${{ inputs.project_id }}" -f itemId="$ITEM_ID" -f fieldId="${{ inputs.status_field_id }}" -f optionId="${{ inputs.status_in_progress_id }}" || true | ||
| fi | ||
| - name: Run Claude Implementation | ||
| if: steps.check.outputs.skip != 'true' | ||
| id: implement | ||
| uses: anthropics/claude-code-action@v1 | ||
| with: | ||
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | ||
| timeout_minutes: 55 | ||
| track_progress: true | ||
| prompt: | | ||
| REPO: ${{ github.repository }} | ||
| ISSUE_NUMBER: ${{ inputs.issue_number }} | ||
| You are implementing issue #${{ inputs.issue_number }} autonomously. | ||
| ## Workflow | ||
| 1. **Read the issue**: `gh issue view ${{ inputs.issue_number }}` | ||
| 2. **Read CLAUDE.md** for repository guidelines | ||
| 3. **Create branch**: `git checkout -b feat/issue-${{ inputs.issue_number }}-[description]` | ||
| 4. **Implement** following existing patterns | ||
| 5. **Write/update tests** | ||
| 6. **Quality checks**: `pnpm typecheck && pnpm lint && pnpm test && pnpm build` | ||
| 7. **Commit**: `git commit -m "feat(scope): description\n\nCloses #${{ inputs.issue_number }}"` | ||
| 8. **Push**: `git push -u origin [branch]` | ||
| 9. **Create PR**: `gh pr create --title "..." --body "..."` | ||
| ## If Blocked | ||
| If you cannot complete the implementation (unclear requirements, need decisions, etc.): | ||
| 1. Post a comment on the issue explaining what you need | ||
| 2. Remove the `agent: claude` label so the workflow doesn't re-trigger | ||
| 3. The human can clarify and re-apply the label when ready | ||
| ```bash | ||
| gh issue comment ${{ inputs.issue_number }} --body "## Need Clarification\n\n[your questions here]\n\n---\n*Removing \`agent: claude\` label until clarified*" | ||
| gh issue edit ${{ inputs.issue_number }} --remove-label "agent: claude" | ||
| ``` | ||
| allowed_tools: | | ||
| Bash(git:*),Bash(gh pr:*),Bash(gh issue:*),Bash(pnpm:*),Bash(npm:*),Bash(npx:*),Bash(node:*),Bash(bun:*),Read,Write,Edit,Glob,Grep,Bash(ls:*),Bash(cat:*),Bash(mkdir:*),Bash(cp:*),Bash(mv:*),Bash(rm:*) | ||
| - name: Post Failure Comment | ||
| if: failure() && steps.check.outputs.skip != 'true' | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
| run: | | ||
| gh issue comment ${{ inputs.issue_number }} --body "## Implementation Failed | ||
| I encountered an error while implementing this issue. | ||
| [View workflow run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) | ||
| The \`agent: claude\` label remains - remove it if you want to stop automated attempts. | ||
| --- | ||
| *Automated implementation by Claude*" | ||