File tree Expand file tree Collapse file tree 3 files changed +104
-0
lines changed
Expand file tree Collapse file tree 3 files changed +104
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Create Repository
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ owner_name :
7+ description : ' Github repo owner name.'
8+ required : true
9+ default : ' github'
10+ new_repo_name :
11+ description : ' Github new repo name.'
12+ required : false
13+ default : ' new-repo'
14+ new_repo_description :
15+ description : ' Github repo description.'
16+ required : false
17+ default : ' Some description'
18+
19+ jobs :
20+ create_repository :
21+
22+ runs-on : ubuntu-latest
23+
24+ steps :
25+ - name : Create a new repo
26+ id : create_new_repo
27+ env :
28+ REPO_OWNER_NAME : ${{ github.event.inputs.owner_name }}
29+ NEW_REPO_NAME : ${{ github.event.inputs.new_repo_name }}
30+ NEW_REPO_DESCRIPTION : ${{ github.event.inputs.new_repo_description }}
31+ GH_TOKEN : ${{ secrets.GH_TOKEN }}
32+ run : |
33+ if gh repo create "${REPO_OWNER_NAME}/${NEW_REPO_NAME}" \
34+ --description "$NEW_REPO_DESCRIPTION" \
35+ --private; then
36+ echo "::notice::Repository '$NEW_REPO_NAME' created successfully!"
37+ exit 0
38+ else
39+ echo "::error::Failed to create repository '$NEW_REPO_NAME'."
40+ exit 1
41+ fi
Original file line number Diff line number Diff line change 1+ name : Delete Repository
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ owner_name :
7+ description : ' Github repo owner name.'
8+ required : true
9+ default : ' github'
10+ repo_name :
11+ description : ' Github new repo name.'
12+ required : false
13+ default : ' new-repo'
14+
15+ jobs :
16+ delete_repository :
17+
18+ runs-on : ubuntu-latest
19+
20+ steps :
21+ - name : Delete a new repo
22+ id : delete_repo
23+ env :
24+ REPO_OWNER_NAME : ${{ github.event.inputs.owner_name }}
25+ REPO_NAME : ${{ github.event.inputs.repo_name }}
26+ GH_TOKEN : ${{ secrets.GH_TOKEN }}
27+ run : |
28+ if gh repo delete "${REPO_OWNER_NAME}/${REPO_NAME}" \
29+ --yes; then
30+ echo "::notice::Repository '$REPO_NAME' deleted successfully!"
31+ exit 0
32+ else
33+ echo "::error::Failed to create repository '$NEW_REPO_NAME'."
34+ exit 1
35+ fi
Original file line number Diff line number Diff line change 1+ name : List Repositories and Save
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ owner_name :
7+ description : ' Github repo owner name.'
8+ required : true
9+ default : ' github'
10+ limit_output :
11+ description : ' Github repo owner name.'
12+ required : false
13+ default : ' 100'
14+
15+ jobs :
16+ list_repos :
17+ runs-on : ubuntu-latest
18+ steps :
19+ - name : List Repositories
20+ run : gh repo list ${{ github.event.inputs.owner_name }} --limit ${{ github.event.inputs.limit_output }} > repositories.txt
21+ env :
22+ GH_TOKEN : ${{ secrets.GH_TOKEN }}
23+
24+ - name : Save file as artefact
25+ uses : actions/upload-artifact@v4
26+ with :
27+ name : repositories-list
28+ path : repositories.txt
You can’t perform that action at this time.
0 commit comments