99 types : [labeled]
1010
1111permissions :
12- issues : write
1312 contents : read
1413
1514jobs :
@@ -140,21 +139,24 @@ jobs:
140139 needs : analyze
141140 runs-on : ubuntu-latest
142141 if : always() && needs.analyze.result != 'skipped'
142+ permissions :
143+ issues : write
144+ contents : read
143145
144146 steps :
145147 - name : Parse and Validate Analysis
146148 id : parse
149+ env :
150+ RESULT : ${{ needs.analyze.outputs.result }}
147151 run : |
148152 # Parse the JSON output from claude-code-action
149- RESULT='${{ needs.analyze.outputs.result }}'
150-
151153 echo "Raw result: $RESULT"
152154
153155 # Extract JSON from the result
154156 JSON=$(echo "$RESULT" | jq -r '.')
155157
156158 # Check if parsing succeeded
157- if [ $? -ne 0 ] ; then
159+ if ! echo "$JSON" | jq -e . > /dev/null 2>&1 ; then
158160 echo "Failed to parse JSON"
159161 exit 1
160162 fi
@@ -173,24 +175,28 @@ jobs:
173175 REASONING=$(echo "$JSON" | jq -r '.reasoning // empty')
174176
175177 # Set outputs
176- echo "status=classified" >> $GITHUB_OUTPUT
177- echo "severity=$SEVERITY" >> $GITHUB_OUTPUT
178- echo "reasoning<<EOF" >> $GITHUB_OUTPUT
179- echo "$REASONING" >> $GITHUB_OUTPUT
180- echo "EOF" >> $GITHUB_OUTPUT
178+ {
179+ echo "status=classified"
180+ echo "severity=$SEVERITY"
181+ echo "reasoning<<EOF"
182+ echo "$REASONING"
183+ echo "EOF"
184+ } >> "$GITHUB_OUTPUT"
181185
182186 elif [ "$STATUS" = "insufficient_info" ]; then
183187 REASONING=$(echo "$JSON" | jq -r '.reasoning // empty')
184188 NEXT_STEPS=$(echo "$JSON" | jq -r '.next_steps | join("\n- ")' | sed 's/^/- /')
185189
186190 # Set outputs
187- echo "status=insufficient_info" >> $GITHUB_OUTPUT
188- echo "reasoning<<EOF" >> $GITHUB_OUTPUT
189- echo "$REASONING" >> $GITHUB_OUTPUT
190- echo "EOF" >> $GITHUB_OUTPUT
191- echo "next_steps<<EOF" >> $GITHUB_OUTPUT
192- echo "$NEXT_STEPS" >> $GITHUB_OUTPUT
193- echo "EOF" >> $GITHUB_OUTPUT
191+ {
192+ echo "status=insufficient_info"
193+ echo "reasoning<<EOF"
194+ echo "$REASONING"
195+ echo "EOF"
196+ echo "next_steps<<EOF"
197+ echo "$NEXT_STEPS"
198+ echo "EOF"
199+ } >> "$GITHUB_OUTPUT"
194200 else
195201 echo "Unknown status: $STATUS"
196202 exit 1
@@ -200,17 +206,19 @@ jobs:
200206 if : steps.parse.outputs.status == 'classified'
201207 env :
202208 GH_TOKEN : ${{ github.token }}
209+ SEVERITY : ${{ steps.parse.outputs.severity }}
210+ REASONING : ${{ steps.parse.outputs.reasoning }}
203211 run : |
204- SEVERITY_UPPER=$(echo "${{ steps.parse.outputs.severity }} " | tr '[:lower:]' '[:upper:]')
212+ SEVERITY_UPPER=$(echo "$SEVERITY " | tr '[:lower:]' '[:upper:]')
205213
206- gh issue comment ${{ github.event.issue.number }} \
207- --repo ${{ github.repository }} \
214+ gh issue comment " ${{ github.event.issue.number }}" \
215+ --repo " ${{ github.repository }}" \
208216 --body "## 🤖 Automated Severity Classification
209217
210218 **Recommended Severity:** \`${SEVERITY_UPPER}\`
211219
212220 **Analysis:**
213- ${{ steps.parse.outputs.reasoning } }
221+ ${REASONING }
214222
215223 ---
216224 *This classification was performed by AI analysis. Please review and adjust if needed.*"
@@ -219,18 +227,20 @@ jobs:
219227 if : steps.parse.outputs.status == 'insufficient_info'
220228 env :
221229 GH_TOKEN : ${{ github.token }}
230+ REASONING : ${{ steps.parse.outputs.reasoning }}
231+ NEXT_STEPS : ${{ steps.parse.outputs.next_steps }}
222232 run : |
223- gh issue comment ${{ github.event.issue.number }} \
224- --repo ${{ github.repository }} \
233+ gh issue comment " ${{ github.event.issue.number }}" \
234+ --repo " ${{ github.repository }}" \
225235 --body "## 🤖 Automated Severity Classification
226236
227237 **Status:** Unable to classify - insufficient information
228238
229239 **Reasoning:**
230- ${{ steps.parse.outputs.reasoning } }
240+ ${REASONING }
231241
232242 **Suggested next steps:**
233- ${{ steps.parse.outputs.next_steps } }
243+ ${NEXT_STEPS }
234244
235245 ---
236246 *This classification was performed by AI analysis. Please provide the requested information for proper severity assessment.*"
0 commit comments