|
1 | 1 | #!/bin/bash
|
2 | 2 | set -e
|
3 | 3 |
|
4 |
| -# IMPORTANT:a valid GITHUB_TOKEN is required to run this script |
| 4 | +# IMPORTANT: a valid X_GITHUB_TOKEN is required to run this script |
| 5 | +# Token must have the following permissions: 'admin:org', 'codespace', 'repo' |
5 | 6 |
|
6 | 7 | GITHUB_REPOSITORY="Azure-Samples/contoso-real-estate"
|
7 | 8 | BRANCH="codespaces-ci"
|
@@ -49,9 +50,9 @@ function api_create_codespace() {
|
49 | 50 | -f machineType=l'argePremiumLinux' \
|
50 | 51 | -f status='true' \
|
51 | 52 | -f defaultPermissions='true')
|
52 |
| - CODESPACE_ID=$(echo "$response" | jq '.name') |
53 |
| - CODESPACE_URL=$(echo "$response" | jq '.web_url') |
54 |
| - CODESPACE_API=$(echo "$response" | jq '.url') |
| 53 | + CODESPACE_ID=$(echo "$response" | jq -r '.name') |
| 54 | + CODESPACE_URL=$(echo "$response" | jq -r '.web_url') |
| 55 | + CODESPACE_API=$(echo "$response" | jq -r '.url') |
55 | 56 | echo "Codespace created and started:"
|
56 | 57 | echo " - ID: $CODESPACE_ID"
|
57 | 58 | echo " - Web: $CODESPACE_URL"
|
@@ -91,7 +92,7 @@ function gh_codespace_check_services_status() {
|
91 | 92 | echo "---------------------------------------------------------------------------------------------------------"
|
92 | 93 | for service in $services; do
|
93 | 94 | echo -ne "Inspecting: $service ... "
|
94 |
| - status=$(curl -H "X-Github-Token: $GITHUB_TOKEN" -s -o /dev/null -w "%{http_code}" $service) |
| 95 | + status=$(curl -H "X-Github-Token: $X_GITHUB_TOKEN" -s -o /dev/null -w "%{http_code}" $service) |
95 | 96 |
|
96 | 97 | if [ $status == 200 ] || [ $status == 404 ]; then
|
97 | 98 | echo -e "${GREEN}$status OK${NC}"
|
|
0 commit comments