Skip to content

Commit

Permalink
ci: use proper token var
Browse files Browse the repository at this point in the history
  • Loading branch information
manekinekko committed Apr 4, 2024
1 parent 1e24992 commit 6068f87
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/codespaces-ci.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash
set -e

# IMPORTANT:a valid GITHUB_TOKEN is required to run this script
# IMPORTANT: a valid X_GITHUB_TOKEN is required to run this script
# Token must have the following permissions: 'admin:org', 'codespace', 'repo'

GITHUB_REPOSITORY="Azure-Samples/contoso-real-estate"
BRANCH="codespaces-ci"
Expand Down Expand Up @@ -49,9 +50,9 @@ function api_create_codespace() {
-f machineType=l'argePremiumLinux' \
-f status='true' \
-f defaultPermissions='true')
CODESPACE_ID=$(echo "$response" | jq '.name')
CODESPACE_URL=$(echo "$response" | jq '.web_url')
CODESPACE_API=$(echo "$response" | jq '.url')
CODESPACE_ID=$(echo "$response" | jq -r '.name')
CODESPACE_URL=$(echo "$response" | jq -r '.web_url')
CODESPACE_API=$(echo "$response" | jq -r '.url')
echo "Codespace created and started:"
echo " - ID: $CODESPACE_ID"
echo " - Web: $CODESPACE_URL"
Expand Down Expand Up @@ -91,7 +92,7 @@ function gh_codespace_check_services_status() {
echo "---------------------------------------------------------------------------------------------------------"
for service in $services; do
echo -ne "Inspecting: $service ... "
status=$(curl -H "X-Github-Token: $GITHUB_TOKEN" -s -o /dev/null -w "%{http_code}" $service)
status=$(curl -H "X-Github-Token: $X_GITHUB_TOKEN" -s -o /dev/null -w "%{http_code}" $service)

if [ $status == 200 ] || [ $status == 404 ]; then
echo -e "${GREEN}$status OK${NC}"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codespaces-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ jobs:

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

0 comments on commit 6068f87

Please sign in to comment.