Skip to content

Commit ff110f7

Browse files
authored
Update setup-new-repo.yml
1 parent 2f5d343 commit ff110f7

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

.github/workflows/setup-new-repo.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,24 @@ jobs:
6868
if gh api orgs/$OWNER/teams > /dev/null 2>&1; then
6969
if ! gh api orgs/$OWNER/teams/$MAINTAINERS_TEAM > /dev/null 2>&1; then
7070
MAINTAINERS_PARENT_ID=$(gh api orgs/$OWNER/teams/maintainers | jq -r '.id')
71-
gh api orgs/$OWNER/teams -f name="$MAINTAINERS_TEAM" -f parent_team_id="$MAINTAINERS_PARENT_ID"
71+
MAINTAINERS_PARENT_ID_NUM=$(printf '%d' "$MAINTAINERS_PARENT_ID" 2>/dev/null || echo "")
72+
if [ -z "$MAINTAINERS_PARENT_ID_NUM" ]; then
73+
echo "::error::Invalid team ID format for maintainers. Expected numeric ID."
74+
exit 1
75+
fi
76+
gh api orgs/$OWNER/teams -f name="$MAINTAINERS_TEAM" -f parent_team_id=$MAINTAINERS_PARENT_ID_NUM
7277
else
7378
echo "Team $MAINTAINERS_TEAM already exists. Skipping creation."
7479
fi
7580
7681
if ! gh api orgs/$OWNER/teams/$CODEOWNERS_TEAM > /dev/null 2>&1; then
7782
CODEOWNERS_PARENT_ID=$(gh api orgs/$OWNER/teams/codeowners | jq -r '.id')
78-
gh api orgs/$OWNER/teams -f name="$CODEOWNERS_TEAM" -f parent_team_id="$CODEOWNERS_PARENT_ID"
83+
CODEOWNERS_PARENT_ID_NUM=$(printf '%d' "$CODEOWNERS_PARENT_ID" 2>/dev/null || echo "")
84+
if [ -z "$CODEOWNERS_PARENT_ID_NUM" ]; then
85+
echo "::error::Invalid team ID format for codeowners. Expected numeric ID."
86+
exit 1
87+
fi
88+
gh api orgs/$OWNER/teams -f name="$CODEOWNERS_TEAM" -f parent_team_id=$CODEOWNERS_PARENT_ID_NUM
7989
else
8090
echo "Team $CODEOWNERS_TEAM already exists. Skipping creation."
8191
fi

0 commit comments

Comments
 (0)