From e65df452d2cf2293fe496d8248be6df118020fac Mon Sep 17 00:00:00 2001 From: Peter Laudati Date: Mon, 6 Nov 2023 22:14:39 -0500 Subject: [PATCH 01/11] Added OpenAI Fundamentals to WTH home page AND linked to it from the archived "002-IntroToAI" hack --- 002-IntroToAzureAI/README.md | 2 ++ README.md | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/002-IntroToAzureAI/README.md b/002-IntroToAzureAI/README.md index b89057686d..614976fc20 100644 --- a/002-IntroToAzureAI/README.md +++ b/002-IntroToAzureAI/README.md @@ -2,6 +2,8 @@ **NOTE: This hack has been marked as "archived" since one of the data sources used by students is no longer available.** +**NOTE:** Please see our NEW hack on [Azure OpenAI Fundamentals](../066-OpenAIFundamentals/README.md) which should replace this hack. + If you would like to update this hack so we can "un-archive" it, please submit a proposal to the What The Hack team as per our [WTH Contribution Guide](https://aka.ms/wthcontribute). We welcome contributions and can provide you more details on what would be needed to update it. ## Introduction diff --git a/README.md b/README.md index 0a577cbc72..62106bad8c 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,7 @@ Here is the current list of What The Hack hackathons available in this repositor - [Azure Chaos Studio for AKS](/055-ChaosStudio4AKS/README.md) ## Data & AI +- [Azure OpenAI Fundamentals](/066-OpenAIFundamentals/README.md) - [Cosmic Troubleshooting](/056-CosmicTroubleshooting/README.md) - [Data Governance with Microsoft Purview](/051-MicrosoftPurview/README.md) - [SQL Modernization and Migration](/043-SQLModernization/README.md) @@ -120,8 +121,6 @@ Here is the current list of What The Hack hackathons available in this repositor - [Bronze/Silver/Gold Using Synapse & Databricks](/060-SynapseAndDatabricks/README.md) - [Conversational AI](/030-ConversationalAI/README.md) - [Databricks/Intro to ML](/008-DatabricksIntroML/README.md) -- [Intro To Azure AI](/002-IntroToAzureAI/README.md) - ARCHIVED -- [Driving Miss Data](/003-DrivingMissData/README.md) - ARCHIVED ## Microsoft Teams Platform - [Microsoft Teams: Make It Real](/034-MicrosoftTeams-MakeItReal/README.md) @@ -151,7 +150,7 @@ Here is the current list of What The Hack hackathons available in this repositor These hacks have been archived due to obsolescence or dependencies on sample code or data that is no longer available. If you are interested in updating these hacks, [contributions are welcome](CONTRIBUTING.md)! Please consider contributing to keep What The Hack up to date. -- [Intro To Azure AI](/002-IntroToAzureAI/README.md) +- [Intro To Azure AI](/002-IntroToAzureAI/README.md) - Be sure to see our NEW hack on [Azure OpenAI Fundamentals](/066-OpenAIFundamentals/README.md) - [Driving Miss Data](/003-DrivingMissData/README.md) # License From b83d74bfab1dad3ec1a288feff000b1e1c38ff32 Mon Sep 17 00:00:00 2001 From: Peter Laudati Date: Mon, 6 Nov 2023 22:22:07 -0500 Subject: [PATCH 02/11] added whitelist file for 002 --- 002-IntroToAzureAI/.wordlist.txt | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 002-IntroToAzureAI/.wordlist.txt diff --git a/002-IntroToAzureAI/.wordlist.txt b/002-IntroToAzureAI/.wordlist.txt new file mode 100644 index 0000000000..9e219c4f3f --- /dev/null +++ b/002-IntroToAzureAI/.wordlist.txt @@ -0,0 +1,5 @@ +Edell +IntelligentKiosk +ServiceHelpers +botframework +customvision \ No newline at end of file From 67fd4b0c4b15e01fe060e1ede341f6147c533e8a Mon Sep 17 00:00:00 2001 From: "Peter C. Laudati" Date: Wed, 10 Apr 2024 23:27:08 -0400 Subject: [PATCH 03/11] Update README.md added link to 069 to the homepage --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 62106bad8c..3c54302e63 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,7 @@ Here is the current list of What The Hack hackathons available in this repositor ## Data & AI - [Azure OpenAI Fundamentals](/066-OpenAIFundamentals/README.md) +- [Fabric Real-time Analytics](/069-FabricRealTimeAnalytics/README.md) - [Cosmic Troubleshooting](/056-CosmicTroubleshooting/README.md) - [Data Governance with Microsoft Purview](/051-MicrosoftPurview/README.md) - [SQL Modernization and Migration](/043-SQLModernization/README.md) From c66b443d6e8ac09a6bffa63051f2a49c3e305d8f Mon Sep 17 00:00:00 2001 From: "Peter C. Laudati" Date: Sun, 12 May 2024 22:39:15 -0400 Subject: [PATCH 04/11] Update spellcheck.yml Testing md_in_html extension for pyseplling --- .github/workflows/spell-check/spellcheck.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/spell-check/spellcheck.yml b/.github/workflows/spell-check/spellcheck.yml index bb80ac62a8..354cf7553e 100644 --- a/.github/workflows/spell-check/spellcheck.yml +++ b/.github/workflows/spell-check/spellcheck.yml @@ -14,6 +14,7 @@ matrix: - pyspelling.filters.markdown: markdown_extensions: - pymdownx.superfences + - md_in_html - pyspelling.filters.html: comments: false ignores: From a2c9fbcc233d90194f8121414b94f434df5e7f09 Mon Sep 17 00:00:00 2001 From: Peter Laudati Date: Sun, 3 Aug 2025 22:57:25 -0400 Subject: [PATCH 05/11] added top-level devcontainer files for 068 AI Apps hack --- .devcontainer/068-AzureOpenAIApps/Dockerfile | 19 +++++++ .../068-AzureOpenAIApps/devcontainer.json | 55 +++++++++++++++++++ .../068-AzureOpenAIApps/postAttachCommands.sh | 25 +++++++++ 3 files changed, 99 insertions(+) create mode 100644 .devcontainer/068-AzureOpenAIApps/Dockerfile create mode 100644 .devcontainer/068-AzureOpenAIApps/devcontainer.json create mode 100755 .devcontainer/068-AzureOpenAIApps/postAttachCommands.sh diff --git a/.devcontainer/068-AzureOpenAIApps/Dockerfile b/.devcontainer/068-AzureOpenAIApps/Dockerfile new file mode 100644 index 0000000000..2dddc78bba --- /dev/null +++ b/.devcontainer/068-AzureOpenAIApps/Dockerfile @@ -0,0 +1,19 @@ +# Use the official Microsoft Python Dev Container image +FROM mcr.microsoft.com/devcontainers/python:3.11 + +# Install any additional dependencies +RUN apt-get update && apt-get install -y \ + && apt-get clean -y && rm -rf /var/lib/apt/lists/* + +# Install Azure CLI and Bicep +RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash && \ + az bicep install + +# Set the working directory +WORKDIR /workspace + +# Copy the current directory contents into the container +COPY . /workspace + +# Install Python dependencies if requirements.txt exists +RUN if [ -f "requirements.txt" ]; then pip install -r requirements.txt; fi \ No newline at end of file diff --git a/.devcontainer/068-AzureOpenAIApps/devcontainer.json b/.devcontainer/068-AzureOpenAIApps/devcontainer.json new file mode 100644 index 0000000000..c7f7e371b5 --- /dev/null +++ b/.devcontainer/068-AzureOpenAIApps/devcontainer.json @@ -0,0 +1,55 @@ +{ + "name": "What The Hack AI Apps", + "build": { + "dockerfile": "Dockerfile", + "context": "..", + "options": [ + "--platform=linux/amd64" + ] + }, + "workspaceFolder": "/workspace/068-AzureOpenAIApps/Student/Resources", + "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached", + "onCreateCommand": "npm install -g @angular/cli azure-functions-core-tools@4", + "postAttachCommand": "bash .devcontainer/postAttachCommands.sh", + "features": { + "ghcr.io/devcontainers/features/azure-cli:1": { + "installBicep": false + }, + "ghcr.io/devcontainers/features/node:1": {}, + "ghcr.io/devcontainers/features/github-cli:1": {} + }, + "customizations": { + "codespaces": { + "openFiles": [] + }, + "vscode": { + "extensions": [ + "ms-dotnettools.vscode-dotnet-runtime", + "ms-dotnettools.csdevkit", + "ms-dotnettools.csharp", + "ms-azuretools.vscode-azurefunctions", + "ms-vscode.vscode-typescript-next", + "ms-vscode.azure-account", + "ms-azuretools.vscode-azureresourcegroups", + "humao.rest-client", + "ms-azuretools.vscode-bicep", + "adamraichu.pdf-viewer" + ] + } + }, + "hostRequirements": { + "cpus": 2 + }, + "forwardPorts": [ + 7072, + 4200 // Added port 4200 + ], + "portsAttributes": { + "7072": { + "label": "backend" + }, + "4200": { // Added attributes for port 4200 + "label": "frontend" + } + } +} \ No newline at end of file diff --git a/.devcontainer/068-AzureOpenAIApps/postAttachCommands.sh b/.devcontainer/068-AzureOpenAIApps/postAttachCommands.sh new file mode 100755 index 0000000000..0cca741185 --- /dev/null +++ b/.devcontainer/068-AzureOpenAIApps/postAttachCommands.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +# Log some info we might need to troubleshoot. +ls /workspaces > ~/postAttachCommands.log +env >> ~/postAttachCommands.log + +# Retrieve the Codespace name if not already set. +if [ -z "$CODESPACE_NAME" ]; then + CODESPACE_NAME=$(gh codespace list --json name --jq '.[0].name') +fi + +# Change the backend and frontend port visibility to public... +gh codespace ports -c $CODESPACE_NAME >> ~/postAttachCommands.log +gh codespace ports visibility 7072:public -c $CODESPACE_NAME +gh codespace ports visibility 4200:public -c $CODESPACE_NAME +gh codespace ports -c $CODESPACE_NAME >> ~/postAttachCommands.log + +# Update the backend URL in the environment.ts file. +BACKEND_ADDRESS=$(gh codespace ports -c $CODESPACE_NAME --json label,browseUrl | jq -r '.[] | select(.label == "backend").browseUrl') +sed -i 's|http://localhost:7072|'$BACKEND_ADDRESS'|g' $CODESPACE_VSCODE_FOLDER/ContosoAIAppsFrontend/src/environments/environment.ts + +# Update the frontend URL in the environment.ts file (if needed). +FRONTEND_ADDRESS=$(gh codespace ports -c $CODESPACE_NAME --json label,browseUrl | jq -r '.[] | select(.label == "frontend").browseUrl') +sed -i 's|http://localhost:4200|'$FRONTEND_ADDRESS'|g' $CODESPACE_VSCODE_FOLDER/ContosoAIAppsFrontend/src/environments/environment.ts + From 9b110d029896637d601204f66cf4fc1e23e4ed9a Mon Sep 17 00:00:00 2001 From: Peter Laudati Date: Sun, 3 Aug 2025 22:59:28 -0400 Subject: [PATCH 06/11] Revert "added top-level devcontainer files for 068 AI Apps hack" This reverts commit a2c9fbcc233d90194f8121414b94f434df5e7f09. --- .devcontainer/068-AzureOpenAIApps/Dockerfile | 19 ------- .../068-AzureOpenAIApps/devcontainer.json | 55 ------------------- .../068-AzureOpenAIApps/postAttachCommands.sh | 25 --------- 3 files changed, 99 deletions(-) delete mode 100644 .devcontainer/068-AzureOpenAIApps/Dockerfile delete mode 100644 .devcontainer/068-AzureOpenAIApps/devcontainer.json delete mode 100755 .devcontainer/068-AzureOpenAIApps/postAttachCommands.sh diff --git a/.devcontainer/068-AzureOpenAIApps/Dockerfile b/.devcontainer/068-AzureOpenAIApps/Dockerfile deleted file mode 100644 index 2dddc78bba..0000000000 --- a/.devcontainer/068-AzureOpenAIApps/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -# Use the official Microsoft Python Dev Container image -FROM mcr.microsoft.com/devcontainers/python:3.11 - -# Install any additional dependencies -RUN apt-get update && apt-get install -y \ - && apt-get clean -y && rm -rf /var/lib/apt/lists/* - -# Install Azure CLI and Bicep -RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash && \ - az bicep install - -# Set the working directory -WORKDIR /workspace - -# Copy the current directory contents into the container -COPY . /workspace - -# Install Python dependencies if requirements.txt exists -RUN if [ -f "requirements.txt" ]; then pip install -r requirements.txt; fi \ No newline at end of file diff --git a/.devcontainer/068-AzureOpenAIApps/devcontainer.json b/.devcontainer/068-AzureOpenAIApps/devcontainer.json deleted file mode 100644 index c7f7e371b5..0000000000 --- a/.devcontainer/068-AzureOpenAIApps/devcontainer.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "What The Hack AI Apps", - "build": { - "dockerfile": "Dockerfile", - "context": "..", - "options": [ - "--platform=linux/amd64" - ] - }, - "workspaceFolder": "/workspace/068-AzureOpenAIApps/Student/Resources", - "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached", - "onCreateCommand": "npm install -g @angular/cli azure-functions-core-tools@4", - "postAttachCommand": "bash .devcontainer/postAttachCommands.sh", - "features": { - "ghcr.io/devcontainers/features/azure-cli:1": { - "installBicep": false - }, - "ghcr.io/devcontainers/features/node:1": {}, - "ghcr.io/devcontainers/features/github-cli:1": {} - }, - "customizations": { - "codespaces": { - "openFiles": [] - }, - "vscode": { - "extensions": [ - "ms-dotnettools.vscode-dotnet-runtime", - "ms-dotnettools.csdevkit", - "ms-dotnettools.csharp", - "ms-azuretools.vscode-azurefunctions", - "ms-vscode.vscode-typescript-next", - "ms-vscode.azure-account", - "ms-azuretools.vscode-azureresourcegroups", - "humao.rest-client", - "ms-azuretools.vscode-bicep", - "adamraichu.pdf-viewer" - ] - } - }, - "hostRequirements": { - "cpus": 2 - }, - "forwardPorts": [ - 7072, - 4200 // Added port 4200 - ], - "portsAttributes": { - "7072": { - "label": "backend" - }, - "4200": { // Added attributes for port 4200 - "label": "frontend" - } - } -} \ No newline at end of file diff --git a/.devcontainer/068-AzureOpenAIApps/postAttachCommands.sh b/.devcontainer/068-AzureOpenAIApps/postAttachCommands.sh deleted file mode 100755 index 0cca741185..0000000000 --- a/.devcontainer/068-AzureOpenAIApps/postAttachCommands.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -# Log some info we might need to troubleshoot. -ls /workspaces > ~/postAttachCommands.log -env >> ~/postAttachCommands.log - -# Retrieve the Codespace name if not already set. -if [ -z "$CODESPACE_NAME" ]; then - CODESPACE_NAME=$(gh codespace list --json name --jq '.[0].name') -fi - -# Change the backend and frontend port visibility to public... -gh codespace ports -c $CODESPACE_NAME >> ~/postAttachCommands.log -gh codespace ports visibility 7072:public -c $CODESPACE_NAME -gh codespace ports visibility 4200:public -c $CODESPACE_NAME -gh codespace ports -c $CODESPACE_NAME >> ~/postAttachCommands.log - -# Update the backend URL in the environment.ts file. -BACKEND_ADDRESS=$(gh codespace ports -c $CODESPACE_NAME --json label,browseUrl | jq -r '.[] | select(.label == "backend").browseUrl') -sed -i 's|http://localhost:7072|'$BACKEND_ADDRESS'|g' $CODESPACE_VSCODE_FOLDER/ContosoAIAppsFrontend/src/environments/environment.ts - -# Update the frontend URL in the environment.ts file (if needed). -FRONTEND_ADDRESS=$(gh codespace ports -c $CODESPACE_NAME --json label,browseUrl | jq -r '.[] | select(.label == "frontend").browseUrl') -sed -i 's|http://localhost:4200|'$FRONTEND_ADDRESS'|g' $CODESPACE_VSCODE_FOLDER/ContosoAIAppsFrontend/src/environments/environment.ts - From 6e785dda04defe0a7680afafb15d08591b88e5a4 Mon Sep 17 00:00:00 2001 From: Peter Laudati Date: Tue, 16 Jun 2026 14:40:54 -0400 Subject: [PATCH 07/11] Add Codespace configuration option to Create New Hack action When authors invoke the Create New Hack workflow, they can now check an 'Include a GitHub Codespace configuration?' option. When enabled: - Creates .devcontainer/devcontainer.json in Student/Resources with the hack name updated (workspace lines remain commented for local use) - Creates .devcontainer/xxx-HackName/devcontainer.json at the repo root with workspaceFolder and workspaceMount uncommented and populated The workflow conditionally stages the root .devcontainer folder only when the codespace option is selected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/create-new-hack.yml | 14 +++++++- .github/workflows/create-wth-template.sh | 46 ++++++++++++++++++++++-- 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-new-hack.yml b/.github/workflows/create-new-hack.yml index 98e5d2f068..1e93333665 100644 --- a/.github/workflows/create-new-hack.yml +++ b/.github/workflows/create-new-hack.yml @@ -12,6 +12,10 @@ on: description: The number of challenges you want (note that it is better to auto-generate more challenges than you think you will need, you can always delete the files later) required: true default: '3' + includeCodespace: + description: Include a GitHub Codespace configuration? + type: boolean + default: false jobs: createNewWhatTheHackTemplate: runs-on: ubuntu-latest @@ -27,10 +31,18 @@ jobs: git config user.email "<>" git checkout -b ${{ env.BRANCH_NAME }} - name: Generate WhatTheHack template stubs - run: ${{ github.workspace }}/.github/workflows/create-wth-template.sh -p ${{ github.workspace }} -c ${{ github.event.inputs.numberOfChallenges}} -n ${{ github.event.inputs.hackName }} -v -d + run: | + CODESPACE_FLAG="" + if [ "${{ github.event.inputs.includeCodespace }}" = "true" ]; then + CODESPACE_FLAG="-s" + fi + ${{ github.workspace }}/.github/workflows/create-wth-template.sh -p ${{ github.workspace }} -c ${{ github.event.inputs.numberOfChallenges}} -n ${{ github.event.inputs.hackName }} -v -d $CODESPACE_FLAG - name: Push branch run: | git add * + if [ "${{ github.event.inputs.includeCodespace }}" = "true" ]; then + git add .devcontainer + fi git commit -m 'Created WhatTheHack template stub' git push -u origin ${{ env.BRANCH_NAME }} diff --git a/.github/workflows/create-wth-template.sh b/.github/workflows/create-wth-template.sh index 501f7e2781..73850877ef 100755 --- a/.github/workflows/create-wth-template.sh +++ b/.github/workflows/create-wth-template.sh @@ -6,13 +6,14 @@ IFS=$'\n\t' declare -r templateDirectoryName="000-HowToHack" Help() { - echo "Syntax: createWthTemplate [-c|d|h|n|p|v]" + echo "Syntax: createWthTemplate [-c|d|h|n|p|s|v]" echo "options:" echo "c How many challenges to stub out." echo "d Delete existing directory with same name." echo "h Print this Help." echo "n Name of the new WhatTheHack. This must be a valid directory name" echo "p Path to where to create new WhatTheHack directory." + echo "s Include GitHub Codespace configuration." echo "v Verbose mode." echo } @@ -55,6 +56,41 @@ CreateDirectoryStructure() { touch $rootPath/Student/Resources/.gitkeep } +CreateCodespaceConfig() { + local -r templateFile="$pathToTemplateDirectory/devcontainerTEMPLATE.json" + + if $verbosityArg; then + echo "Creating Codespace configuration for $wthDirectoryName..." + fi + + # Create the Student/Resources/.devcontainer directory + mkdir -p "$rootPath/Student/Resources/.devcontainer" + + # Remove the .gitkeep since the directory is no longer empty + rm -f "$rootPath/Student/Resources/.gitkeep" + + # Create Student/Resources copy: update "name" only, leave workspace lines commented + sed -e "s/\"xxx-HackName\"/\"$wthDirectoryName\"/" \ + "$templateFile" > "$rootPath/Student/Resources/.devcontainer/devcontainer.json" + + if $verbosityArg; then + echo "Created $rootPath/Student/Resources/.devcontainer/devcontainer.json" + fi + + # Create root-level .devcontainer/xxx-HackName directory + mkdir -p "$pathArg/.devcontainer/$wthDirectoryName" + + # Create root-level copy: update "name", uncomment and populate workspaceFolder/workspaceMount + sed -e "s/\"xxx-HackName\"/\"$wthDirectoryName\"/" \ + -e "s|// \"workspaceFolder\": \"/workspace/XXX-HackathonName/Student/Resources\"|\"workspaceFolder\": \"/workspace/$wthDirectoryName/Student/Resources\"|" \ + -e "s|// \"workspaceMount\": \"source=\${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached\"|\"workspaceMount\": \"source=\${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached\"|" \ + "$templateFile" > "$pathArg/.devcontainer/$wthDirectoryName/devcontainer.json" + + if $verbosityArg; then + echo "Created $pathArg/.devcontainer/$wthDirectoryName/devcontainer.json" + fi +} + PreprocessTemplateFile() { local -r pathToFile=$1 @@ -244,8 +280,9 @@ CreateChallengesAndSolutions() { # Main program declare verbosityArg=false declare deleteExistingDirectoryArg=false +declare codespaceArg=false -while getopts ":c:dhn:p:v" option; do +while getopts ":c:dhn:p:sv" option; do case $option in c) numberOfChallengesArg=${OPTARG};; d) deleteExistingDirectoryArg=true;; @@ -253,6 +290,7 @@ while getopts ":c:dhn:p:v" option; do exit;; n) nameOfHackArg=${OPTARG};; p) pathArg=${OPTARG};; + s) codespaceArg=true;; v) verbosityArg=true esac done @@ -275,3 +313,7 @@ CreateDirectoryStructure $deleteExistingDirectoryArg CreateHackDescription $numberOfChallengesArg CreateChallengesAndSolutions $numberOfChallengesArg + +if $codespaceArg; then + CreateCodespaceConfig +fi From 19ad1d529f3d0ab7f03c78c0eb24bb96a436374c Mon Sep 17 00:00:00 2001 From: Peter Laudati Date: Tue, 16 Jun 2026 15:09:21 -0400 Subject: [PATCH 08/11] Keep .gitkeep in Student/Resources when codespace is included Ensures the Resources folder remains visible on GitHub even when the .devcontainer subfolder is present, so authors know where to place files. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/create-wth-template.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/create-wth-template.sh b/.github/workflows/create-wth-template.sh index 73850877ef..2fab46a927 100755 --- a/.github/workflows/create-wth-template.sh +++ b/.github/workflows/create-wth-template.sh @@ -66,9 +66,6 @@ CreateCodespaceConfig() { # Create the Student/Resources/.devcontainer directory mkdir -p "$rootPath/Student/Resources/.devcontainer" - # Remove the .gitkeep since the directory is no longer empty - rm -f "$rootPath/Student/Resources/.gitkeep" - # Create Student/Resources copy: update "name" only, leave workspace lines commented sed -e "s/\"xxx-HackName\"/\"$wthDirectoryName\"/" \ "$templateFile" > "$rootPath/Student/Resources/.devcontainer/devcontainer.json" From 4a56cb5454b34f0bd9e136ec5f14214b94d97f36 Mon Sep 17 00:00:00 2001 From: Peter Laudati Date: Tue, 16 Jun 2026 17:33:25 -0400 Subject: [PATCH 09/11] Update devcontainer template comments for dual-purpose use The template now has full instructions for authors manually adding Codespace support to existing hacks (wrapped in TEMPLATE_INSTRUCTIONS markers). When the Create New Hack action copies the template, it strips these markers/instructions and inserts a brief customization comment with a link to the devcontainer reference docs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/create-wth-template.sh | 23 +++++++++++++++++------ 000-HowToHack/devcontainerTEMPLATE.json | 21 ++++++++++++++++----- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/.github/workflows/create-wth-template.sh b/.github/workflows/create-wth-template.sh index 2fab46a927..7899ccb9ba 100755 --- a/.github/workflows/create-wth-template.sh +++ b/.github/workflows/create-wth-template.sh @@ -66,9 +66,16 @@ CreateCodespaceConfig() { # Create the Student/Resources/.devcontainer directory mkdir -p "$rootPath/Student/Resources/.devcontainer" - # Create Student/Resources copy: update "name" only, leave workspace lines commented - sed -e "s/\"xxx-HackName\"/\"$wthDirectoryName\"/" \ - "$templateFile" > "$rootPath/Student/Resources/.devcontainer/devcontainer.json" + # Prepare the brief comment header for Action-created copies + local -r briefComment="// Customize this devcontainer.json with features and extensions for your hackathon.\n// See: https://containers.dev/implementors/json_reference/\n" + + # Create Student/Resources copy: strip template instructions, update "name", leave workspace lines commented + sed -e '/TEMPLATE_INSTRUCTIONS_START/,/TEMPLATE_INSTRUCTIONS_END/d' \ + -e "s/\"xxx-HackName\"/\"$wthDirectoryName\"/" \ + "$templateFile" | sed "1i\\ +// Customize this devcontainer.json with features and extensions for your hackathon.\\ +// See: https://containers.dev/implementors/json_reference/" \ + > "$rootPath/Student/Resources/.devcontainer/devcontainer.json" if $verbosityArg; then echo "Created $rootPath/Student/Resources/.devcontainer/devcontainer.json" @@ -77,11 +84,15 @@ CreateCodespaceConfig() { # Create root-level .devcontainer/xxx-HackName directory mkdir -p "$pathArg/.devcontainer/$wthDirectoryName" - # Create root-level copy: update "name", uncomment and populate workspaceFolder/workspaceMount - sed -e "s/\"xxx-HackName\"/\"$wthDirectoryName\"/" \ + # Create root-level copy: strip template instructions, update "name", uncomment and populate workspace settings + sed -e '/TEMPLATE_INSTRUCTIONS_START/,/TEMPLATE_INSTRUCTIONS_END/d' \ + -e "s/\"xxx-HackName\"/\"$wthDirectoryName\"/" \ -e "s|// \"workspaceFolder\": \"/workspace/XXX-HackathonName/Student/Resources\"|\"workspaceFolder\": \"/workspace/$wthDirectoryName/Student/Resources\"|" \ -e "s|// \"workspaceMount\": \"source=\${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached\"|\"workspaceMount\": \"source=\${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached\"|" \ - "$templateFile" > "$pathArg/.devcontainer/$wthDirectoryName/devcontainer.json" + "$templateFile" | sed "1i\\ +// Customize this devcontainer.json with features and extensions for your hackathon.\\ +// See: https://containers.dev/implementors/json_reference/" \ + > "$pathArg/.devcontainer/$wthDirectoryName/devcontainer.json" if $verbosityArg; then echo "Created $pathArg/.devcontainer/$wthDirectoryName/devcontainer.json" diff --git a/000-HowToHack/devcontainerTEMPLATE.json b/000-HowToHack/devcontainerTEMPLATE.json index e01e8451a1..a4dd67b51c 100644 --- a/000-HowToHack/devcontainerTEMPLATE.json +++ b/000-HowToHack/devcontainerTEMPLATE.json @@ -1,16 +1,27 @@ +// TEMPLATE_INSTRUCTIONS_START // This is a template devcontainer.json for What The Hack hackathons. // It provides a baseline configuration for GitHub Codespaces and VS Code Dev Containers. // -// Instructions for hackathon authors: -// 1. Copy this file to your hack's .devcontainer folder as devcontainer.json -// 2. Uncomment and update "workspaceFolder" and "workspaceMount" with your hack's folder name -// 3. Add any additional features or extensions specific to your hackathon -// +// Instructions for hackathon authors adding Codespace support to an existing hack: +// 1. Copy this file to the following two locations: +// a. Your hack's /Student/Resources/.devcontainer/ folder as devcontainer.json +// b. Under the root-level /.devcontainer/ folder, create a folder with the same +// name as your hack's folder (e.g., "xxx-HackName") and add a copy there. +// 2. In both copies, update the "name" field with your hack's folder name. +// 3. Only in the root-level /.devcontainer/xxx-HackName/ copy, uncomment and update +// "workspaceFolder" and "workspaceMount" with your hack's folder name. +// 4. Add any additional features or extensions specific to your hackathon. +// See: https://containers.dev/implementors/json_reference/ +// TEMPLATE_INSTRUCTIONS_END { + // TEMPLATE_INSTRUCTIONS_START // Update "name" with your hack's number and name (e.g., "042-SAPOnAzure") + // TEMPLATE_INSTRUCTIONS_END "name": "xxx-HackName", "image": "mcr.microsoft.com/devcontainers/universal:2", + // TEMPLATE_INSTRUCTIONS_START // Uncomment and update the following two properties with your hack's folder name: + // TEMPLATE_INSTRUCTIONS_END // "workspaceFolder": "/workspace/XXX-HackathonName/Student/Resources", // "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached", "hostRequirements": { From 828a0f8af83a846f64515c520e39b41734796362 Mon Sep 17 00:00:00 2001 From: "Peter C. Laudati" Date: Tue, 16 Jun 2026 18:11:05 -0400 Subject: [PATCH 10/11] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/create-wth-template.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-wth-template.sh b/.github/workflows/create-wth-template.sh index 7899ccb9ba..be74cba2aa 100755 --- a/.github/workflows/create-wth-template.sh +++ b/.github/workflows/create-wth-template.sh @@ -13,7 +13,7 @@ Help() { echo "h Print this Help." echo "n Name of the new WhatTheHack. This must be a valid directory name" echo "p Path to where to create new WhatTheHack directory." - echo "s Include GitHub Codespace configuration." + echo "s Include GitHub Codespaces configuration." echo "v Verbose mode." echo } From d1c8644996f375842fa8b02b636f209b0b063f93 Mon Sep 17 00:00:00 2001 From: Andy Huang <54148527+Whowong@users.noreply.github.com> Date: Thu, 18 Jun 2026 16:23:44 -0700 Subject: [PATCH 11/11] Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/create-new-hack.yml | 2 +- .github/workflows/create-wth-template.sh | 8 ++++---- 000-HowToHack/devcontainerTEMPLATE.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/create-new-hack.yml b/.github/workflows/create-new-hack.yml index 1e93333665..deb6571d14 100644 --- a/.github/workflows/create-new-hack.yml +++ b/.github/workflows/create-new-hack.yml @@ -13,7 +13,7 @@ on: required: true default: '3' includeCodespace: - description: Include a GitHub Codespace configuration? + description: Include a GitHub Codespaces configuration? type: boolean default: false jobs: diff --git a/.github/workflows/create-wth-template.sh b/.github/workflows/create-wth-template.sh index be74cba2aa..9ac6b6b4b6 100755 --- a/.github/workflows/create-wth-template.sh +++ b/.github/workflows/create-wth-template.sh @@ -60,7 +60,7 @@ CreateCodespaceConfig() { local -r templateFile="$pathToTemplateDirectory/devcontainerTEMPLATE.json" if $verbosityArg; then - echo "Creating Codespace configuration for $wthDirectoryName..." + echo "Creating Codespaces configuration for $wthDirectoryName..." fi # Create the Student/Resources/.devcontainer directory @@ -71,7 +71,7 @@ CreateCodespaceConfig() { # Create Student/Resources copy: strip template instructions, update "name", leave workspace lines commented sed -e '/TEMPLATE_INSTRUCTIONS_START/,/TEMPLATE_INSTRUCTIONS_END/d' \ - -e "s/\"xxx-HackName\"/\"$wthDirectoryName\"/" \ + -e "s/\"xxx-HackName\"/\"${wthDirectoryName//&/\\&}\"/" \ "$templateFile" | sed "1i\\ // Customize this devcontainer.json with features and extensions for your hackathon.\\ // See: https://containers.dev/implementors/json_reference/" \ @@ -86,8 +86,8 @@ CreateCodespaceConfig() { # Create root-level copy: strip template instructions, update "name", uncomment and populate workspace settings sed -e '/TEMPLATE_INSTRUCTIONS_START/,/TEMPLATE_INSTRUCTIONS_END/d' \ - -e "s/\"xxx-HackName\"/\"$wthDirectoryName\"/" \ - -e "s|// \"workspaceFolder\": \"/workspace/XXX-HackathonName/Student/Resources\"|\"workspaceFolder\": \"/workspace/$wthDirectoryName/Student/Resources\"|" \ + -e "s/\"xxx-HackName\"/\"${wthDirectoryName//&/\\&}\"/" \ + -e "s|// \"workspaceFolder\": \"/workspace/XXX-HackathonName/Student/Resources\"|\"workspaceFolder\": \"/workspace/${wthDirectoryName//&/\\&}/Student/Resources\"|" \ -e "s|// \"workspaceMount\": \"source=\${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached\"|\"workspaceMount\": \"source=\${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached\"|" \ "$templateFile" | sed "1i\\ // Customize this devcontainer.json with features and extensions for your hackathon.\\ diff --git a/000-HowToHack/devcontainerTEMPLATE.json b/000-HowToHack/devcontainerTEMPLATE.json index a4dd67b51c..7e3690384c 100644 --- a/000-HowToHack/devcontainerTEMPLATE.json +++ b/000-HowToHack/devcontainerTEMPLATE.json @@ -2,7 +2,7 @@ // This is a template devcontainer.json for What The Hack hackathons. // It provides a baseline configuration for GitHub Codespaces and VS Code Dev Containers. // -// Instructions for hackathon authors adding Codespace support to an existing hack: +// Instructions for hackathon authors adding Codespaces support to an existing hack: // 1. Copy this file to the following two locations: // a. Your hack's /Student/Resources/.devcontainer/ folder as devcontainer.json // b. Under the root-level /.devcontainer/ folder, create a folder with the same