-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (57 loc) · 1.56 KB
/
repo-deletion.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Delete Repo
on:
workflow_call:
inputs:
repo_name:
description: "Name"
required: true
type: string
workflow_dispatch:
inputs:
repo_name:
description: "Name"
required: true
type: string
default: "TestCompany-TestTeam-TestProject"
permissions:
actions: write
issues: write
env:
REPO_NAME: ${{ vars.ORGANIZATION }}/${{ inputs.repo_name }}
jobs:
lookup:
name: "Check if Repo Exists"
runs-on: ubuntu-latest
steps:
- name: Get Token
id: get-workflow-token
uses: peter-murray/workflow-application-token-action@v2
with:
application_id: ${{ vars.GH_APP_ID }}
application_private_key: ${{ secrets.GH_APP_KEY }}
organization: ${{ vars.ORGANIZATION }}
- name: Lookup Repo
env:
GH_TOKEN: ${{ steps.get-workflow-token.outputs.token }}
run: |
gh repo view $REPO_NAME
delete-repo:
needs:
- lookup
name: "Delete Repo"
runs-on: ubuntu-latest
environment: deletion
concurrency: delete-${{ inputs.repo_name }}
steps:
- name: Get Token
id: get-workflow-token
uses: peter-murray/workflow-application-token-action@v2
with:
application_id: ${{ vars.GH_APP_ID }}
application_private_key: ${{ secrets.GH_APP_KEY }}
organization: ${{ vars.ORGANIZATION }}
- name: Delete Repo
env:
GH_TOKEN: ${{ steps.get-workflow-token.outputs.token }}
run: |
gh repo delete $REPO_NAME --yes