Skip to content

Commit 29dbdb4

Browse files
committed
chore(scripts): update for full approval
1 parent c02ceea commit 29dbdb4

2 files changed

Lines changed: 12 additions & 29 deletions

File tree

.github/scripts/update-linear-status.sh

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,43 +16,17 @@ fi
1616
TICKET_COUNT=$(echo "$TICKETS_JSON" | jq '. | length')
1717
echo "Updating status for $TICKET_COUNT tickets..."
1818

19-
# First, we need to get the "Done" workflow state ID from Linear
20-
# We'll fetch workflow states and find the one named "Done"
21-
WORKFLOW_QUERY=$(cat <<'EOF'
22-
{
23-
"query": "query { workflowStates { nodes { id name } } }"
24-
}
25-
EOF
26-
)
27-
28-
WORKFLOW_RESPONSE=$(curl -s -X POST \
29-
-H "Content-Type: application/json" \
30-
-H "Authorization: ${LINEAR_API_KEY}" \
31-
-d "$WORKFLOW_QUERY" \
32-
https://api.linear.app/graphql)
33-
34-
DONE_STATE_ID=$(echo "$WORKFLOW_RESPONSE" | jq -r '.data.workflowStates.nodes[] | select(.name == "Done") | .id' | head -n1)
35-
36-
if [ -z "$DONE_STATE_ID" ]; then
37-
echo "Error: Could not find 'Done' workflow state in Linear."
38-
echo "Available states:"
39-
echo "$WORKFLOW_RESPONSE" | jq -r '.data.workflowStates.nodes[] | " - \(.name)"'
40-
exit 1
41-
fi
42-
43-
echo "Found 'Done' state ID: $DONE_STATE_ID"
44-
4519
# Update each ticket
4620
UPDATED_COUNT=0
4721
FAILED_COUNT=0
4822

4923
for i in $(seq 0 $((TICKET_COUNT - 1))); do
5024
TICKET_ID=$(echo "$TICKETS_JSON" | jq -r ".[$i]")
5125

52-
# First, get the issue ID (not the identifier like "DEV-123")
26+
# Get the issue ID, current state, and team's Done state in one query
5327
ISSUE_QUERY=$(cat <<EOF
5428
{
55-
"query": "query { issue(id: \"$TICKET_ID\") { id identifier state { name } } }"
29+
"query": "query { issue(id: \"$TICKET_ID\") { id identifier state { name } team { states { nodes { id name } } } } }"
5630
}
5731
EOF
5832
)
@@ -78,6 +52,15 @@ EOF
7852
continue
7953
fi
8054

55+
# Get the Done state ID for this issue's team
56+
DONE_STATE_ID=$(echo "$ISSUE_RESPONSE" | jq -r '.data.issue.team.states.nodes[] | select(.name == "Done") | .id' | head -n1)
57+
58+
if [ -z "$DONE_STATE_ID" ]; then
59+
echo " [FAIL] ${TICKET_ID} - Could not find 'Done' state for issue's team"
60+
((FAILED_COUNT++))
61+
continue
62+
fi
63+
8164
# Update the issue state
8265
UPDATE_QUERY=$(cat <<EOF
8366
{

.github/workflows/codeowners-approved-slack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
description: "If true, only notify when reviewDecision is APPROVED. If false, notify on first approval."
1313
required: false
1414
type: boolean
15-
default: false
15+
default: true
1616
slack-message-prefix:
1717
description: "Custom prefix for Slack message (emoji + text)"
1818
required: false

0 commit comments

Comments
 (0)