Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:Testtimescaling Testtimescaling github io Course Branch Bootstrapping

From Leeroopedia


Knowledge Sources
Domains Education, CI_CD, Version_Control
Last Updated 2026-02-14 00:00 GMT

Overview

Automated repository scaffolding for interactive learning courses that initializes a learner's environment upon repository creation from a template.

Description

When a learner creates a repository from a GitHub Skills template, the course infrastructure must bootstrap itself automatically. Course Branch Bootstrapping solves this by detecting the initial push to the main branch and executing a one-time setup sequence: creating an isolated feature branch, generating starter files with placeholder content, and opening a pull request that serves as the central learning context for the entire course.

This principle separates the environment setup concern from the learning progression concern. Step 0 is structurally unique among all course steps because it performs repository mutation (branch creation, file generation, PR opening) rather than simply detecting a learner action and advancing a counter. The step-guard pattern (Template:Code) ensures that this heavyweight initialization runs exactly once, providing idempotency even if the workflow is re-triggered.

The bootstrapping step establishes three artifacts that all subsequent steps depend on:

  1. Feature branch (Template:Code) -- an isolated workspace where the learner makes changes without affecting the main branch.
  2. Starter files (Template:Code, Template:Code) -- minimal content that gives the learner something to build upon in later steps.
  3. Pull request -- the conversational context where the course bot can post instructions, the learner can ask questions, and the final merge represents course completion.

Usage

Use this principle when:

  • Building GitHub Skills-style interactive courses that need automated environment setup after learners fork or create from a template repository
  • Designing any template-based onboarding workflow where the initial repository state must be transformed before the learner begins working
  • Implementing step-gated CI/CD pipelines where step 0 has unique scaffolding responsibilities distinct from the progression pattern used by later steps

Theoretical Basis

Template-based learning environments use automation to create a consistent starting point for every learner. The bootstrapping process follows a deterministic sequence:

1. Detect repository creation

The workflow triggers on Template:Code to main. When a learner creates a repository from the template, GitHub automatically pushes the template contents to main, firing this trigger. The Template:Code trigger provides a manual fallback.

2. Verify step precondition

The workflow reads the current step number from the flat-file state store (Template:Code). If the value is not Template:Code, the workflow exits early. This guard prevents re-execution if a later push to main occurs (e.g., during the final merge step).

3. Prevent template self-execution

The condition Template:Code ensures the workflow does not run inside the template repository itself, only in repositories created from it.

4. Create the working branch

A new branch (Template:Code) is created from main. This isolates learner changes and enables the pull request workflow.

5. Scaffold starter files

Two files are generated:

These files are committed using the Template:Code identity and pushed to the new branch.

6. Advance the step counter

The Template:Code action reads the state file, verifies it matches Template:Code, writes Template:Code to the state file, and replaces the README with the step 1 instructions. This transitions the course from the bootstrapping phase to the learning progression phase.

The idempotency guarantee is critical: because the step guard checks the state file before performing any mutations, re-running the workflow after step 0 has completed produces no side effects.

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment