This repository is a template for all new Knowledge Exchange Hub (KEH) repositories. It contains the basic structure and files that are common to all KEH repositories, such as CODEOWNERS, sample GitHub Actions workflows, and a README template.
To use this template when creating a new repository, simply select "Use this template" on GitHub and follow the prompts to create your new repository based on this template. This will ensure that your new repository has the necessary structure and files to maintain consistency across all KEH repositories.
Since this repository is intended for all KEH repositories, it needs some additional setup once you have created your new repository. The steps below outline the necessary customisation and setup:
- Update the README: Replace the content of the README with information relevant to your project. This should use the template below as a starting point.
- Update CODEOWNERS: Modify the CODEOWNERS file to chose the appropriate team. The 2 options for KEH are within the file itself.
- Set up GitHub Actions: This repository has already setup some sample GitHub Actions workflows (i.e. MkDocs related actions and Megalinter). In addition to this, the repository should also have its primary language linter and test workflow set up. Placeholders for these workflows are already in place, so you just need to fill in the details (ci-fmt, ci-test).
- Setup Repository Settings: The repository should have the following settings configured:
- Contributors:
- Add
keh-devto the repository with Write access. - Add
keh-dev-adminto the repository with Admin access.
- Add
- Branch Protection Rules:
- Within
Rules > Rulesets, create a new branch ruleset for themainbranch. - Add the following rules to the ruleset:
- Add
keh-dev-adminto the Bypass List. This is for emergency situations where you need to bypass branch protection rules. - Target the Default Branch (
main). - Restrict deletions.
- Require a pull request before merging. This should require at least 2 approving reviews.
- Block force pushes.
- Add
- Save the ruleset.
- Within
- Contributors:
- Setup Repository for Project Use: Now that the housekeeping is done, you can set up the repository for project use.
When using Python, Poetry has already been setup for dependency management since it is used for documentation.
Ensure that you update the pyproject.toml file to match the needs of your project.
The below is a template for the README file that should be used for all KEH repositories. This template provides a basic structure and can be customised to fit the specific needs of your project.
Everything above this line should be removed when customising the README for your project.
This project uses a Makefile to simplify common tasks. To see the available commands, run:
make allThis repository uses MkDocs for documentation. The documentation source files are located in the docs directory.
MkDocs gets deployed to GitHub Pages using GitHub Actions. The workflow for this is located at .github/workflows/deploy-docs.yml.
Before deployment, another GitHub Action workflow runs to check that the documentation builds correctly and has no linting or formatting issues.
This workflow is located at .github/workflows/ci-docs.yml.
To run the documentation locally:
-
Install the dependencies for MkDocs.
poetry install --only docs
-
Run the MkDocs development server.
poetry run mkdocs serve
This repository has GitHub Actions workflows set up for linting and testing. The workflows are located at:
.github/workflows/ci-fmt.ymlfor linting and formatting checks (primary language)..github/workflows/ci-test.ymlfor running automated tests..github/workflows/ci-docs.ymlfor checking that the documentation builds correctly and has no linting or formatting issues..github/workflows/megalinter.ymlfor running MegaLinter, which checks for linting and formatting issues across multiple languages and file types (this is a catch-all linter)..github/workflows/deploy-docs.ymlfor deploying documentation to GitHub Pages.
This repository uses MegaLinter for comprehensive linting across multiple languages and file types. We use this so that all additional assets in the repository (e.g. YAML files, Markdown files, etc.) are also linted and checked for formatting issues, without having to set up specific linters for each file type.
To run MegaLinter locally, you can use the following command:
docker run --platform linux/amd64 --rm \
-v /var/run/docker.sock:/var/run/docker.sock:rw \
-v $(shell pwd):/tmp/lint:rw \
oxsecurity/megalinter:v8This repository uses Markdownlint for linting the documentation. To run Markdownlint locally, you can use the following:
-
Install the dependencies for Markdownlint.
npm install -g markdownlint-cli
-
Run Markdownlint.
markdownlint .(Optional) Add the
--fixflag to automatically fix any linting issues that can be fixed.markdownlint . --fix
To test that the documentation builds correctly, you can use the following command:
poetry run mkdocs buildNote: This depends on MkDocs being set up for the repository. Instructions for setting up MkDocs can be found in the Documentation section of this README.