On September 1, 2022, GitHub Learning Lab will shut down.
Read more on the GitHub blog and check out GitHub Skills for courses backed by GitHub Actions.

Building: Writing responses

GitHub Learning Lab is no longer accepting new public courses from outside of GitHub.

GitHub Learning Lab's mascot A course on GitHub Learning Lab can guide you through this step.

Responses are stored in the responses/ folder within the course repository. Each response should be a Markdown file. The name doesn't matter, but you can use some naming conventions to help, such as numbering your responses (1-welcome.md), or prefixing the filename with e if the response is for helping learners navigate from errors (e-you-didnt-comment.md).

For more detail into response best practices, see the appendix.


Throughout the course, you can make use of template variables to create a more personalized experience for your users. Here are all of the available template variables that you can use in your responses:

Property Description
course.title The title of the course.
course.slug The slug of the course. If the course is titled "My Course", the slug will be "my-course."
user.login The username of the user taking the course.
preferences[preference_name] Get the value of a preference choice made by the user. This will look like preferences.name_of_preference.
owner The owner of the repository that the user is taking the course in. This is usually the user, but for private courses it will be the login of an organization.
repo The name of the repository that the user is taking the course in. This is particularly useful for private courses, as repo names are namespaced for the user.
repoUrl The URL for the user's repository.
payload The payload from the last webhook handled by Learning Lab. This is typically the webhook from the event for the current step.
GHE_HOST Domain hostname (and optional port) if Learning Lab is running on GitHub Enterprise Server. Otherwise undefined.
GITHUB_URL The URL for Learning Lab, regardless of hosting
course.Owner.login The owner and author (organization or user) of the Learning Lab course

Usage examples

Using a global variable

@{{ user.login }} refers to a user by their handle. This can create a more personal and engaging experience for your users.

An example of the learner's view and the source:

Learner view Source in Markdown
image image

Using the response payload

'{{ payload.issue.title }}' will display the issue title as it appears in the payload of the webhook.

Note that the webhook payload is what Learning Lab receives when the user performs the event selected in the step and is replaced when the user moves on to the next step in the course. If you'd like to save any of this information to be used later, check out the data store.

If you'd like to know what information is being passed in the payload, consider using SMEE.io to inspect your webhook payloads during testing.

Custom data variables

It's also possible to create your own variables, see Passing data into responses.