-
Notifications
You must be signed in to change notification settings - Fork 36
/
build-testcase-workflow-github-app
executable file
·69 lines (49 loc) · 1.86 KB
/
build-testcase-workflow-github-app
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
63
64
65
66
67
68
# Create a repository and setup a workflow that uses a GitHub App
# Prior to running this, make any needed modifications to test-data/workflow-github-app.yml_
# that are needed for the testcase.
#
normal=$(tput sgr0)
highlight=$(tput setaf 2)
yellow=$(tput setaf 3)
printf "$highlight"
cat << EOF
________ ____
/_ __/ /_ ___ / __ \____ _ _____ _____
/ / / __ \/ _ \ / /_/ / __ \ | /| / / _ \/ ___/
/ / / / / / __/ / ____/ /_/ / |/ |/ / __/ /
/_/ /_/ /_/\___/ /_/ \____/|__/|__/\___/_/
==================================================
$0
==================================================
EOF
printf "${normal}"
printf "${highlight} - Creating repo: ${normal}"
./create-repo.sh | jq -r '.name'
python3 create-workflow-simple-json-file.py
printf "${highlight} - Creating target repos: ${normal}\n"
./create-repo.sh power-github-app-workflow1 >/dev/null 2>&1
./create-repo.sh power-github-app-workflow2 >/dev/null 2>&1
# This step loads the GitHub App private key into an organization level secret
printf "${highlight} - Creating organization level secret for the GitHub App: ${normal}"
./create-an-organization-secret-for-app-private-key.sh
printf "${highlight} - Committing workflow file: ${normal}"
# ./create-commit-workflow-github-app.sh
./create-commit-workflow-github-app.sh | jq -r '.content.path'
printf "\n"
printf "${yellow} - Press w to trigger a workflow dispatch event. ${normal}\n"
printf "${yellow} - Press r to trigger a repository dispatch event. ${normal}\n"
printf "\n"
read -p "Enter the dispatch event type: " event_type
case $event_type in
w)
echo "workflow_dispatch"
./create-a-workflow-dispatch-event.sh
;;
r)
echo "repository_dispatch"
./dispatch-event.sh
;;
*)
echo "Invalid option"
;;
esac