Skip to content

Commit 9bdf113

Browse files
committed
fix: report Linear mutation transport failures
1 parent ec0dd4e commit 9bdf113

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

.github/workflows/vulnerability-triage.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -652,11 +652,14 @@ jobs:
652652
CREATE_LABEL_MUTATION='mutation($teamId: String!, $name: String!) { issueLabelCreate(input: { teamId: $teamId, name: $name }) { success issueLabel { id } } }'
653653
CREATE_LABEL_PAYLOAD=$(jq -n --arg query "$CREATE_LABEL_MUTATION" --arg teamId "$TEAM_UUID" --arg name "$REPOSITORY" \
654654
'{query: $query, variables: {teamId: $teamId, name: $name}}')
655-
CREATE_LABEL_RESPONSE=$(LINEAR_API_KEY="$LINEAR_API_KEY" \
656-
.vulnerability-triage-workflow/.github/scripts/linear-graphql-request.sh <<<"$CREATE_LABEL_PAYLOAD")
657-
REPO_LABEL_ID=$(echo "$CREATE_LABEL_RESPONSE" | jq -r '.data.issueLabelCreate.issueLabel.id // empty')
658-
if [ -z "$REPO_LABEL_ID" ]; then
659-
echo "::warning::Could not create '$REPOSITORY' label: $(echo "$CREATE_LABEL_RESPONSE" | jq -c '.errors // .')"
655+
if ! CREATE_LABEL_RESPONSE=$(LINEAR_API_KEY="$LINEAR_API_KEY" \
656+
.vulnerability-triage-workflow/.github/scripts/linear-graphql-request.sh <<<"$CREATE_LABEL_PAYLOAD"); then
657+
echo "::warning::Linear request failed while creating '$REPOSITORY' label. Continuing without it; the next run will query for an ambiguously committed label."
658+
else
659+
REPO_LABEL_ID=$(echo "$CREATE_LABEL_RESPONSE" | jq -r '.data.issueLabelCreate.issueLabel.id // empty')
660+
if [ -z "$REPO_LABEL_ID" ]; then
661+
echo "::warning::Could not create '$REPOSITORY' label: $(echo "$CREATE_LABEL_RESPONSE" | jq -c '.errors // .')"
662+
fi
660663
fi
661664
fi
662665
@@ -1012,8 +1015,13 @@ jobs:
10121015
10131016
CLOSE_VARS=$(jq -n --arg issueId "$ISSUE_ID" --arg stateId "$DONE_STATE_ID" '{issueId: $issueId, stateId: $stateId}')
10141017
CLOSE_PAYLOAD=$(jq -n --arg query "$CLOSE_MUTATION" --argjson vars "$CLOSE_VARS" '{query: $query, variables: $vars}')
1015-
CLOSE_RESPONSE=$(LINEAR_API_KEY="$LINEAR_API_KEY" \
1016-
.vulnerability-triage-workflow/.github/scripts/linear-graphql-request.sh <<<"$CLOSE_PAYLOAD")
1018+
if ! CLOSE_RESPONSE=$(LINEAR_API_KEY="$LINEAR_API_KEY" \
1019+
.vulnerability-triage-workflow/.github/scripts/linear-graphql-request.sh <<<"$CLOSE_PAYLOAD"); then
1020+
echo "::error::Linear request failed while closing $ISSUE_IDENTIFIER"
1021+
echo "- **FAILED** to close [$ISSUE_IDENTIFIER]($ISSUE_URL)" >> "$GITHUB_STEP_SUMMARY"
1022+
FAILED_COUNT=$((FAILED_COUNT + 1))
1023+
continue
1024+
fi
10171025
10181026
if [ "$(echo "$CLOSE_RESPONSE" | jq -r '.data.issueUpdate.success // false')" = "true" ]; then
10191027
echo "Closed $ISSUE_IDENTIFIER — $FINDING_ID is no longer reported"

0 commit comments

Comments
 (0)