Skip to content

Commit 97e1652

Browse files
authored
Update setup-new-repo.yml
Adding debug lines, moved repo creation one step down
1 parent 74da861 commit 97e1652

1 file changed

Lines changed: 22 additions & 20 deletions

File tree

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

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,32 +43,14 @@ jobs:
4343
echo "GH_TOKEN=${{ secrets.GH_REPO_CREATE_TOKEN }}" >> $GITHUB_ENV
4444
echo "Token GH_REPO_CREATE_TOKEN ready for use in GitHub CLI"
4545
46-
- name: Create new repository and set variables
47-
run: |
48-
REPO_NAME=${{ github.event.inputs.repo_name }}
49-
OWNER=$(echo '${{ github.repository }}' | cut -d'/' -f1)
50-
51-
echo "Checking if repository $OWNER/$REPO_NAME already exists..."
52-
if gh api repos/$OWNER/$REPO_NAME > /dev/null 2>&1; then
53-
echo "::error::Repository $OWNER/$REPO_NAME already exists. Exiting."
54-
exit 1
55-
fi
56-
57-
echo "Creating new repository: https://github.com/$OWNER/$REPO_NAME"
58-
gh repo create "$OWNER/$REPO_NAME" --public --template "$OWNER/$(basename '${{ github.repository }}')" --confirm
59-
60-
echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV
61-
echo "OWNER=$OWNER" >> $GITHUB_ENV
62-
echo "MAINTAINERS_TEAM=${REPO_NAME}_maintainers" >> $GITHUB_ENV
63-
echo "CODEOWNERS_TEAM=${REPO_NAME}_codeowners" >> $GITHUB_ENV
64-
echo "CODEOWNERS_LIST=${{ github.event.inputs.initial_codeowners }}" >> $GITHUB_ENV
65-
6646
- name: Create teams
6747
run: |
6848
if gh api orgs/$OWNER/teams > /dev/null 2>&1; then
6949
if ! gh api orgs/$OWNER/teams/$MAINTAINERS_TEAM > /dev/null 2>&1; then
7050
MAINTAINERS_PARENT_ID=$(gh api orgs/$OWNER/teams/maintainers | jq -r '.id')
51+
echo "Debug: MAINTAINERS_PARENT_ID=$MAINTAINERS_PARENT_ID "
7152
MAINTAINERS_PARENT_ID_NUM=$(echo "$MAINTAINERS_PARENT_ID" | grep -o '[0-9]*')
53+
echo "Debug: MAINTAINERS_PARENT_ID_NUM=$MAINTAINERS_PARENT_ID_NUM "
7254
if [ -z "$MAINTAINERS_PARENT_ID_NUM" ]; then
7355
echo "::error::Invalid team ID format for maintainers. Expected numeric ID."
7456
exit 1
@@ -105,6 +87,26 @@ jobs:
10587
echo "Skipping team creation — not running in an organization."
10688
fi
10789
90+
- name: Create new repository and set variables
91+
run: |
92+
REPO_NAME=${{ github.event.inputs.repo_name }}
93+
OWNER=$(echo '${{ github.repository }}' | cut -d'/' -f1)
94+
95+
echo "Checking if repository $OWNER/$REPO_NAME already exists..."
96+
if gh api repos/$OWNER/$REPO_NAME > /dev/null 2>&1; then
97+
echo "::error::Repository $OWNER/$REPO_NAME already exists. Exiting."
98+
exit 1
99+
fi
100+
101+
echo "Creating new repository: https://github.com/$OWNER/$REPO_NAME"
102+
gh repo create "$OWNER/$REPO_NAME" --public --template "$OWNER/$(basename '${{ github.repository }}')" --confirm
103+
104+
echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV
105+
echo "OWNER=$OWNER" >> $GITHUB_ENV
106+
echo "MAINTAINERS_TEAM=${REPO_NAME}_maintainers" >> $GITHUB_ENV
107+
echo "CODEOWNERS_TEAM=${REPO_NAME}_codeowners" >> $GITHUB_ENV
108+
echo "CODEOWNERS_LIST=${{ github.event.inputs.initial_codeowners }}" >> $GITHUB_ENV
109+
108110
- name: Configure repository settings
109111
run: |
110112
gh repo edit $OWNER/$REPO_NAME \

0 commit comments

Comments
 (0)