|
43 | 43 | echo "GH_TOKEN=${{ secrets.GH_REPO_CREATE_TOKEN }}" >> $GITHUB_ENV |
44 | 44 | echo "Token GH_REPO_CREATE_TOKEN ready for use in GitHub CLI" |
45 | 45 |
|
| 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 | +
|
46 | 66 | - name: Create teams |
47 | 67 | run: | |
48 | 68 | if gh api orgs/$OWNER/teams > /dev/null 2>&1; then |
@@ -87,26 +107,6 @@ jobs: |
87 | 107 | echo "Skipping team creation — not running in an organization." |
88 | 108 | fi |
89 | 109 |
|
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 | | -
|
110 | 110 | - name: Configure repository settings |
111 | 111 | run: | |
112 | 112 | gh repo edit $OWNER/$REPO_NAME \ |
|
0 commit comments