Skip to content
This repository was archived by the owner on Mar 20, 2025. It is now read-only.

Commit 6068f87

Browse files
committed
ci: use proper token var
1 parent 1e24992 commit 6068f87

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

.github/workflows/codespaces-ci.sh

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/bin/bash
22
set -e
33

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'
56

67
GITHUB_REPOSITORY="Azure-Samples/contoso-real-estate"
78
BRANCH="codespaces-ci"
@@ -49,9 +50,9 @@ function api_create_codespace() {
4950
-f machineType=l'argePremiumLinux' \
5051
-f status='true' \
5152
-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')
5556
echo "Codespace created and started:"
5657
echo " - ID: $CODESPACE_ID"
5758
echo " - Web: $CODESPACE_URL"
@@ -91,7 +92,7 @@ function gh_codespace_check_services_status() {
9192
echo "---------------------------------------------------------------------------------------------------------"
9293
for service in $services; do
9394
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)
9596

9697
if [ $status == 200 ] || [ $status == 404 ]; then
9798
echo -e "${GREEN}$status OK${NC}"

.github/workflows/codespaces-ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ jobs:
1818

1919
- name: Deploy to Codespace
2020
env:
21-
X_GITHUB_TOKEN: ${{ secrets.CODESPACES_TOKEN }}
22-
run: ./.github/workflows/codespaces-ci.sh
21+
X_GITHUB_TOKEN: ${{ secrets.X_GITHUB_TOKEN }}
22+
run: ./.github/workflows/codespaces-ci.sh

0 commit comments

Comments
 (0)