A tool that converts Git repositories using the Gitorial format into structured course content and uploads it to Contentful CMS.
Gitorial is a Git-based tutorial format where each step of a tutorial is represented by commits in a special gitorial branch. The commits follow a specific structure to create an interactive, step-by-step learning experience.
- Clones a repository and processes its
gitorialbranch - Converts commit history into organized lessons and sections
- Generates diff files to show changes between steps
- Creates markdown files with proper formatting
- Uploads everything to Contentful as structured course content
- Clone this repository
git clone https://github.com/dotcodeschool/dotcodeschool-content-script.git- Install dependencies:
pnpm install- Create a
.envfile with:
CONTENTFUL_SPACE_ID=your_space_id
CONTENTFUL_ENVIRONMENT=your_environment
CONTENTFUL_MANAGEMENT_ACCESS_TOKEN=your_token
PARENT_DIR=gitorial_repository_name
- Process a Gitorial repository:
pnpm start <github-repository-url>- Upload to Contentful:
pnpm uploadCommits in the gitorial branch should follow these prefixes:
starting-template:- Initial project setup (skipped in processing)section:- Creates a new course sectiontemplate:- Provides starter code for an exercisesolution:- Shows the solution to the exerciseaction:- Regular tutorial stepreadme:- Documentation/explanation
Each commit's README.md contains the lesson content, and the code changes in the commit represent the step's modifications.
See rust-state-machine for an example of a properly formatted Gitorial repository.