Skip to content

Commit 0bca378

Browse files
committed
fix: shellcheck SC2001 and SC2015 in claude workflow
Replace sed prompt extraction with parameter expansion (SC2001).
1 parent 83d90a4 commit 0bca378

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

.github/workflows/claude.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,22 +107,20 @@ jobs:
107107
- name: Exchange OIDC for GitHub App token
108108
id: oidc-exchange
109109
run: |
110-
OIDC_RESPONSE=$(curl -s \
110+
OIDC_TOKEN=$(curl -sf \
111111
-H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
112-
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=claude-code-github-action")
113-
OIDC_TOKEN=$(echo "$OIDC_RESPONSE" | jq -r '.value')
112+
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=claude-code-github-action" | jq -r '.value')
114113
if [ -z "$OIDC_TOKEN" ] || [ "$OIDC_TOKEN" = "null" ]; then
115-
echo "::error::OIDC token request failed: $OIDC_RESPONSE"; exit 1
114+
echo "::error::OIDC token request failed"; exit 1
116115
fi
117116
118-
EXCHANGE_RESPONSE=$(curl -s -X POST \
117+
APP_TOKEN=$(curl -sf -X POST \
119118
-H "Authorization: Bearer $OIDC_TOKEN" \
120119
-H "Content-Type: application/json" \
121120
-d '{"permissions":{"contents":"write","pull_requests":"write","issues":"write"}}' \
122-
"https://api.anthropic.com/api/github/github-app-token-exchange")
123-
APP_TOKEN=$(echo "$EXCHANGE_RESPONSE" | jq -r '.token')
121+
"https://api.anthropic.com/api/github/github-app-token-exchange" | jq -r '.token')
124122
if [ -z "$APP_TOKEN" ] || [ "$APP_TOKEN" = "null" ]; then
125-
echo "::error::Token exchange failed: $EXCHANGE_RESPONSE"; exit 1
123+
echo "::error::Token exchange failed"; exit 1
126124
fi
127125
128126
echo "::add-mask::$APP_TOKEN"
@@ -233,7 +231,7 @@ jobs:
233231
claude plugin install zama-developer@zama-marketplace
234232
235233
# Extract prompt: everything after "@claude" in the comment
236-
PROMPT=$(echo "$COMMENT_BODY" | sed 's/.*@claude[[:space:]]*//')
234+
PROMPT=${COMMENT_BODY#*@claude }
237235
238236
claude -p "$PROMPT" \
239237
--model opus \
@@ -271,8 +269,8 @@ jobs:
271269
- name: Revoke GitHub App token
272270
if: always() && steps.oidc-exchange.outputs.app_token != ''
273271
run: |
274-
REVOKE_OUTPUT=$(gh api "installation/token" -X DELETE 2>&1) || {
275-
echo "::warning::Token revocation failed: $REVOKE_OUTPUT"
272+
gh api "installation/token" -X DELETE || {
273+
echo "::warning::Token revocation failed"
276274
}
277275
env:
278276
GH_TOKEN: ${{ steps.oidc-exchange.outputs.app_token }}

0 commit comments

Comments
 (0)