A common request in the Microsoft WhatTheHack (WTH) repo is for authors to be able to easily create a new WhatTheHack template to get started.
There are some common things that all WhatTheHack repos need.
- Need to follow directory structure (example)
- Need Challenge & Solution Markdown files (example)
- Need a root README.md file
- Need a table of contents & navigation links in each Markdown file
An example of the navigation links would look something like this
To make this easy for a new WTH author, I wrote a simple GitHub Action Workflow that can autogenerate this template.
The specific steps for the job are:
- Create a new Git branch for the author to start with
- Generate the WhatTheHack template stubs
- Push to new Git branch to the GitHub repo
These are encoded into a GitHub Action Workflow.
The template is generated via a bash shell script.
How to use
To generate a new WTH template, the author simply has to run the GitHub Action workflow “Create a new hack”.
Link to the GitHub repo that has the code to generate the template & the workflow.