Skip to content

Commit 6ae0f57

Browse files
committed
test
1 parent 34ae5b6 commit 6ae0f57

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

.github/workflows/delete-repo.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Delete GitHub Repo
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
repo_owner:
7+
description: 'Owner of the repo (user or org)'
8+
required: true
9+
repo_name:
10+
description: 'Name of the repo to delete'
11+
required: true
12+
13+
jobs:
14+
delete_repo:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Delete GitHub repository
18+
env:
19+
GH_TOKEN: ${{ secrets.COMMITTER_TOKEN }} # Inject your custom token here
20+
REPO_OWNER: ${{ github.event.inputs.repo_owner }}
21+
REPO_NAME: ${{ github.event.inputs.repo_name }}
22+
run: |
23+
echo "🔴 Attempting to delete repository: $REPO_OWNER/$REPO_NAME"
24+
25+
response=$(curl -s -o /dev/null -w "%{http_code}" -X DELETE \
26+
-H "Authorization: token $GH_TOKEN" \
27+
-H "Accept: application/vnd.github+json" \
28+
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME")
29+
30+
if [ "$response" == "204" ]; then
31+
echo "✅ Repository $REPO_OWNER/$REPO_NAME successfully deleted."
32+
else
33+
echo "❌ Failed to delete repo. HTTP status: $response"
34+
exit 1
35+
fi

0 commit comments

Comments
 (0)