Skip to content

Commit b492a50

Browse files
msukkariclaude
andcommitted
fix: resolve team UUID from metadata query for Linear issue creation
LINEAR_TEAM_ID may be a team key/slug rather than a UUID. The team(id:) query accepts both, but issueCreate requires a UUID. Now resolves the actual UUID via the metadata query and uses that. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0080fd6 commit b492a50

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

.github/workflows/trivy-vulnerability-triage.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,17 +470,24 @@ jobs:
470470
REPOSITORY: ${{ github.repository }}
471471
run: |
472472
# Look up the "CVE" label ID and "Triage" state ID for the team
473-
METADATA_QUERY='query($teamId: String!) { team(id: $teamId) { labels(filter: { name: { eq: "CVE" } }) { nodes { id } } states(filter: { name: { eq: "Triage" } }) { nodes { id } } } }'
473+
METADATA_QUERY='query($teamId: String!) { team(id: $teamId) { id labels(filter: { name: { eq: "CVE" } }) { nodes { id } } states(filter: { name: { eq: "Triage" } }) { nodes { id } } } }'
474474
METADATA_PAYLOAD=$(jq -n --arg query "$METADATA_QUERY" --arg teamId "$LINEAR_TEAM_ID" \
475475
'{query: $query, variables: {teamId: $teamId}}')
476476
METADATA_RESPONSE=$(curl -s -X POST https://api.linear.app/graphql \
477477
-H "Content-Type: application/json" \
478478
-H "Authorization: $LINEAR_API_KEY" \
479479
-d "$METADATA_PAYLOAD")
480480
481+
# Resolve the actual team UUID (LINEAR_TEAM_ID may be a slug/key, but issueCreate requires a UUID)
482+
TEAM_UUID=$(echo "$METADATA_RESPONSE" | jq -r '.data.team.id // empty')
481483
LABEL_ID=$(echo "$METADATA_RESPONSE" | jq -r '.data.team.labels.nodes[0].id // empty')
482484
STATE_ID=$(echo "$METADATA_RESPONSE" | jq -r '.data.team.states.nodes[0].id // empty')
483485
486+
if [ -z "$TEAM_UUID" ]; then
487+
echo "::error::Could not resolve team UUID from LINEAR_TEAM_ID. Check the secret value."
488+
exit 1
489+
fi
490+
484491
if [ -z "$LABEL_ID" ]; then
485492
echo "::warning::Could not find 'CVE' label in Linear team. Creating issues without label."
486493
fi
@@ -529,7 +536,7 @@ jobs:
529536
530537
# Build variables JSON with jq to handle all escaping properly
531538
VARIABLES=$(jq -n \
532-
--arg teamId "$LINEAR_TEAM_ID" \
539+
--arg teamId "$TEAM_UUID" \
533540
--arg title "$ISSUE_TITLE" \
534541
--arg desc "$DESCRIPTION" \
535542
--argjson priority "$PRIORITY" \

0 commit comments

Comments
 (0)