Skip to content

Commit 482b9bf

Browse files
authored
Merge branch 'main' into copilot/fix-56
2 parents 1feca58 + a6ad1b4 commit 482b9bf

20 files changed

Lines changed: 597 additions & 255 deletions

.devcontainer/devcontainer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
"features": {
2525
"ghcr.io/devcontainers/features/sshd:1": {
2626
"version": "latest"
27+
},
28+
"ghcr.io/devcontainers/features/github-cli:1": {
29+
"version": "latest"
30+
},
31+
"ghcr.io/devcontainers/features/azure-cli:1": {
32+
"version": "latest"
2733
}
2834
}
2935
}

.devcontainer/onCreate.sh

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,20 @@
22

33
set -e
44

5-
echo "Installing the GitHub CLI"
6-
(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
7-
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
8-
&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
9-
&& cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
10-
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
11-
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
12-
&& sudo apt update \
13-
&& sudo apt install gh inotify-tools -y
5+
echo "Setting up node user home directory and permissions"
6+
sudo mkdir -p /home/node/.config/vscode-dev-containers
7+
sudo chown -R node:node /home/node
8+
sudo chmod 755 /home/node
9+
sudo chmod -R 755 /home/node/.config
1410

15-
echo "Installing azcopy"
16-
17-
sudo wget -O /usr/local/bin/azcopytar https://aka.ms/downloadazcopy-v10-linux
18-
sudo tar -xvf /usr/local/bin/azcopytar -C /usr/local/bin/
19-
sudo rm /usr/local/bin/azcopytar
20-
azcopy_dir=$(find /usr/local/bin/ -type d -name "azcopy*" | head -n 1)
21-
sudo mv "$azcopy_dir/azcopy" /usr/local/bin/azcopy
22-
sudo rm -rf "$azcopy_dir"
11+
echo "Installing inotify-tools"
12+
sudo apt update && sudo apt install -y inotify-tools
2313

2414
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2515
"$SCRIPT_DIR/refreshTools.sh"
2616

27-
echo "Pre-starting the server and generating the optimized assets"
28-
npm run optimize --override
17+
echo "Installing Node.js dependencies"
18+
npm install
2919

3020
echo "Installing supervisor"
3121
sudo apt-get update && sudo apt-get install -y supervisor

.devcontainer/refreshTools.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ set -e
44

55
echo "Checking for updates to workbench-template from GitHub"
66

7+
# Ensure jq is installed for JSON parsing
8+
if ! command -v jq &> /dev/null; then
9+
echo "Installing jq for JSON parsing..."
10+
sudo apt-get update && sudo apt-get install -y jq
11+
fi
12+
713
WORKSPACE_DIR="/workspaces/spark-template"
814

915
MARKER_DIR="/var/lib/spark/.versions"
@@ -12,11 +18,28 @@ TOOLS_MARKER_FILE="$MARKER_DIR/tools"
1218

1319
sudo mkdir -p "$MARKER_DIR"
1420

21+
# Check if TEMPLATE_PAT is set
22+
if [ -z "$TEMPLATE_PAT" ]; then
23+
echo "TEMPLATE_PAT environment variable is not set. Skipping tools update."
24+
exit 0
25+
fi
26+
1527
# Fetch the latest release information
1628
LATEST_RELEASE=$(curl -s -H "Authorization: token $TEMPLATE_PAT" https://api.github.com/repos/github/spark-template/releases/latest)
1729

30+
# Check if the API call succeeded
31+
if [ $? -ne 0 ] || [ -z "$LATEST_RELEASE" ]; then
32+
echo "Failed to fetch release information from GitHub. Skipping tools update."
33+
exit 0
34+
fi
35+
1836
# Check if marker file exists and has the same release ID
1937
RELEASE_ID=$(echo "$LATEST_RELEASE" | jq -r '.id')
38+
if [ "$RELEASE_ID" == "null" ] || [ -z "$RELEASE_ID" ]; then
39+
echo "Invalid release data received from GitHub. Skipping tools update."
40+
exit 0
41+
fi
42+
2043
if [ -f "$RELEASE_MARKER_FILE" ] && [ "$(cat "$RELEASE_MARKER_FILE")" == "$RELEASE_ID" ]; then
2144
echo "Already at the latest release. Skipping download."
2245
exit 0
@@ -28,6 +51,13 @@ TEMP_DIR=$(mktemp -d)
2851
cd $TEMP_DIR
2952

3053
DOWNLOAD_URL=$(echo "$LATEST_RELEASE" | jq -r '.assets[0].url')
54+
if [ "$DOWNLOAD_URL" == "null" ] || [ -z "$DOWNLOAD_URL" ]; then
55+
echo "No download URL found in release data. Skipping tools update."
56+
cd - >/dev/null
57+
rm -rf $TEMP_DIR
58+
exit 0
59+
fi
60+
3161
curl -L -o dist.zip -H "Authorization: token $TEMPLATE_PAT" -H "Accept: application/octet-stream" "$DOWNLOAD_URL"
3262

3363
unzip -o dist.zip

.github/workflows/tag-rajbos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ jobs:
2222
uses: devops-actions/issue-comment-tag@v0.1.8
2323
with:
2424
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25-
username: rajbos
25+
team: rajbos

build-for-pages.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ npm install
117117

118118
# Build the app
119119
echo "Building application..."
120+
# Set deploy time for build
121+
export DEPLOY_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
122+
echo "Setting deploy time: $DEPLOY_TIME"
120123
npm run build
121124

122125
# Move the built files to the output directory

deploy-to-pages.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ cat > temp-vite.config.ts <<EOF
3030
$(cat vite.config.ts | sed "s/build: {/build: {\n base: '\/${REPO_NAME}\/',/")
3131
EOF
3232

33+
# Set deploy time for build
34+
export DEPLOY_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
35+
echo "Setting deploy time: $DEPLOY_TIME"
36+
3337
# Build with temporary config
3438
mv temp-vite.config.ts vite.config.ts
3539
npm run build

deploy.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ rm -rf dist
1010

1111
# Build the frontend
1212
echo "Compiling frontend..."
13+
# Set deploy time for build
14+
export DEPLOY_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
15+
echo "Setting deploy time: $DEPLOY_TIME"
16+
1317
npm install -f # force because there is a known mismatch of shadcn and react 19 - https://ui.shadcn.com/docs/react-19
1418
npm run build
1519

favicon.svg

Lines changed: 12 additions & 0 deletions
Loading

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<title>GitHub Copilot Premium Requests Usage Analyzer</title>
88
<link rel="stylesheet" href="/src/main.css" />
99
<link rel="stylesheet" href="/src/index.css" />
10-
<link rel="icon" href="https://github.githubassets.com/favicons/favicon.svg" />
10+
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
1111
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
1212
</head>
1313

0 commit comments

Comments
 (0)