@@ -11,10 +11,6 @@ concurrency:
1111
1212jobs :
1313 trigger-claude-code :
14- # Only run when "approved" label is added to an issue that also has "plot-request"
15- if : |
16- github.event.label.name == 'approved' &&
17- contains(github.event.issue.labels.*.name, 'plot-request')
1814 runs-on : ubuntu-latest
1915 permissions :
2016 contents : write # Allow commits
@@ -24,19 +20,48 @@ jobs:
2420 actions : read # Allow Claude to read CI results
2521
2622 steps :
23+ - name : Check conditions
24+ id : check
25+ run : |
26+ echo "=== Debug Info ==="
27+ echo "Label added: ${{ github.event.label.name }}"
28+ echo "Issue labels: ${{ join(github.event.issue.labels.*.name, ', ') }}"
29+ echo "=================="
30+
31+ # Check 1: Must be "approved" label being added
32+ if [[ "${{ github.event.label.name }}" != "approved" ]]; then
33+ echo "::notice::Skipping: Not the 'approved' label"
34+ echo "should_run=false" >> $GITHUB_OUTPUT
35+ exit 0
36+ fi
37+
38+ # Check 2: Issue must have "plot-request" label
39+ HAS_PLOT_REQUEST="${{ contains(github.event.issue.labels.*.name, 'plot-request') }}"
40+ if [[ "$HAS_PLOT_REQUEST" != "true" ]]; then
41+ echo "::notice::Skipping: Issue does not have 'plot-request' label"
42+ echo "should_run=false" >> $GITHUB_OUTPUT
43+ exit 0
44+ fi
45+
46+ echo "::notice::All conditions met - proceeding with code generation"
47+ echo "should_run=true" >> $GITHUB_OUTPUT
48+
2749 - name : Checkout repository
50+ if : steps.check.outputs.should_run == 'true'
2851 uses : actions/checkout@v4
2952 with :
3053 fetch-depth : 0 # Full history for better context
3154
3255 - name : React with eyes emoji
56+ if : steps.check.outputs.should_run == 'true'
3357 env :
3458 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3559 run : |
3660 gh api repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/reactions \
3761 -f content=eyes
3862
3963 - name : Extract spec ID from issue
64+ if : steps.check.outputs.should_run == 'true'
4065 id : extract_spec
4166 env :
4267 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
92117 echo "✅ Extracted spec ID: $SPEC_ID"
93118
94119 - name : Run Claude Code to generate implementations
120+ if : steps.check.outputs.should_run == 'true'
95121 uses : anthropics/claude-code-action@v1
96122 with :
97123 claude_code_oauth_token : ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
0 commit comments