Skip to content

Commit c6fa614

Browse files
authored
Update setup-new-repo.yml
1 parent 0df527a commit c6fa614

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,12 @@ jobs:
167167
fi
168168
169169
if gh api orgs/$OWNER/teams/$CODEOWNERS_TEAM > /dev/null 2>&1; then
170-
gh api orgs/$OWNER/teams/$CODEOWNERS_TEAM/repos/$OWNER/$REPO_NAME \
171-
-X PUT -H "Accept: application/vnd.github+json" -f permission=write || \
172-
echo "::error::Failed to set permissions for $CODEOWNERS_TEAM. Please check team and repository availability."
170+
echo "Assigning permissions to CODEOWNERS_TEAM: [$CODEOWNERS_TEAM]"
171+
gh api orgs/$OWNER/teams/$CODEOWNERS_TEAM | jq || echo "::warning::Failed to retrieve CODEOWNERS_TEAM info"
172+
gh api orgs/$OWNER/teams | jq '.[] | select(.name | test("codeowners")) | {name, slug}' || echo "::warning::Could not locate CODEOWNERS_TEAM in list"
173+
gh api orgs/$OWNER/teams/$CODEOWNERS_TEAM/repos/$OWNER/$REPO_NAME \
174+
-X PUT -H "Accept: application/vnd.github+json" -f permission=write || \
175+
echo "::error::Failed to set permissions for $CODEOWNERS_TEAM. Please check team and repository availability."
173176
else
174177
echo "::error::Team $CODEOWNERS_TEAM does not exist. Cannot assign permissions."
175178
exit 1

0 commit comments

Comments
 (0)