Skip to content

Commit

Permalink
Add repo deleting
Browse files Browse the repository at this point in the history
  • Loading branch information
AmirrezaNasiri authored Dec 16, 2023
1 parent b4e0603 commit a359683
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/repository-delete.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
required: true
jobs:
backup:
name: Backup the Repository
runs-on: ubuntu-22.04
steps:
- name: Checkout code
Expand All @@ -36,3 +37,19 @@ jobs:
name: ${{ steps.compress.outputs.ARCHIVE }}
path: /tmp/${{ steps.compress.outputs.ARCHIVE }}
retention-days: 60
delete:
name: Delete the Repository
needs: backup
runs-on: ubuntu-22.04
steps:
- name: Delete the repository
run: |
GITHUB_URL=${{ fromJson(inputs.port_payload).payload.entity.properties.url }}
ORG=$(echo "$GITHUB_URL" | cut -d'/' -f4)
REPO=$(echo "$GITHUB_URL" | cut -d'/' -f5)
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GH_ORG_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$ORG/$REPO

0 comments on commit a359683

Please sign in to comment.