Skip to content

[WTH Core] Add Codespace configuration option to Create New Hack action#1200

Open
jrzyshr wants to merge 46 commits into
microsoft:masterfrom
jrzyshr:jrzyshr/createnewhack-codespace
Open

[WTH Core] Add Codespace configuration option to Create New Hack action#1200
jrzyshr wants to merge 46 commits into
microsoft:masterfrom
jrzyshr:jrzyshr/createnewhack-codespace

Conversation

@jrzyshr

@jrzyshr jrzyshr commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR adds an optional "Include a GitHub Codespace configuration?" checkbox to the Create New Hack GitHub Action workflow. When an author enables this option, the action automatically scaffolds the devcontainer configuration in both required locations.

Changes

Workflow (create-new-hack.yml)

  • Added includeCodespace boolean input to the workflow dispatch form
  • Passes -s flag to the shell script when enabled
  • Conditionally stages the root-level .devcontainer folder

Shell script (create-wth-template.sh)

  • Added -s flag and CreateCodespaceConfig() function
  • When invoked, creates:
    • /Student/Resources/.devcontainer/devcontainer.json — workspace lines remain commented (for local devcontainer use)
    • /.devcontainer/xxx-HackName/devcontainer.json — workspace lines uncommented and populated (for GitHub Codespaces)
  • Strips template-only instruction comments from copies and inserts a brief "customize" comment with a link to the devcontainer reference docs

Template (000-HowToHack/devcontainerTEMPLATE.json)

  • Updated comments with full instructions for authors manually adding Codespace support to existing hacks
  • Instructions wrapped in TEMPLATE_INSTRUCTIONS_START/END markers so the action can strip them when creating copies

Behavior

  • Without the checkbox: Action works exactly as before (no breaking changes)
  • With the checkbox: Both devcontainer.json files are created with appropriate content for their location

added link to 069 to the homepage
[Hack Update] 069-RealTimeAnalytics - add listing to WTH homepage
Testing md_in_html extension for pyseplling
jrzyshr and others added 14 commits August 3, 2025 22:57
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>
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>
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>
@jrzyshr jrzyshr requested a review from a team as a code owner June 16, 2026 21:54
@jrzyshr jrzyshr changed the title Add Codespace configuration option to Create New Hack action [WTH Core] Add Codespace configuration option to Create New Hack action Jun 16, 2026
@jrzyshr jrzyshr assigned jrzyshr and Whowong and unassigned jrzyshr Jun 16, 2026
@jrzyshr jrzyshr requested a review from Copilot June 16, 2026 21:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an optional Codespaces/devcontainer scaffolding path to the “Create new hack” workflow so authors can generate the required devcontainer configuration files automatically (instead of manually copying/updating the template).

Changes:

  • Adds a new includeCodespace boolean input to the workflow dispatch form and passes a new -s flag to the generator script.
  • Extends create-wth-template.sh with -s handling to generate devcontainer config into both required locations.
  • Updates 000-HowToHack/devcontainerTEMPLATE.json with richer author instructions and instruction markers that the script strips during generation.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
000-HowToHack/devcontainerTEMPLATE.json Adds instruction markers and expanded guidance for creating devcontainer/Codespaces configuration from the template.
.github/workflows/create-wth-template.sh Introduces -s flag and generation logic to scaffold devcontainer.json files in both required locations.
.github/workflows/create-new-hack.yml Adds a workflow-dispatch checkbox to enable Codespaces scaffolding and conditionally stages generated artifacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +69 to +70
# 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"
Comment thread .github/workflows/create-wth-template.sh Outdated
Comment on lines +62 to +64
if $verbosityArg; then
echo "Creating Codespace configuration for $wthDirectoryName..."
fi
Comment on lines +15 to +17
includeCodespace:
description: Include a GitHub Codespace configuration?
type: boolean
Comment on lines 42 to +45
git add *
if [ "${{ github.event.inputs.includeCodespace }}" = "true" ]; then
git add .devcontainer
fi
Comment thread 000-HowToHack/devcontainerTEMPLATE.json Outdated
Comment on lines +5 to +6
// Instructions for hackathon authors adding Codespace support to an existing hack:
// 1. Copy this file to the following two locations:
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

Comment on lines +69 to +70
# 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"
Comment thread .github/workflows/create-wth-template.sh Outdated
Comment thread .github/workflows/create-wth-template.sh Outdated
Comment thread .github/workflows/create-new-hack.yml Outdated
Comment thread .github/workflows/create-wth-template.sh Outdated
Comment thread 000-HowToHack/devcontainerTEMPLATE.json Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants