Add New GitHub Repository Checklist
This runbook contains the details and checklist for ensuring a new GitHub repository is fully adopted and integrqated with the team’s workflow, tools and the team are admins.
Follow the checklists (onboarding & configure), below those linked are detailed explanations of each item. These checklists conform to the GitHub Repository Standards in the Ministry of Justice as referenced in the repository’s templated README.
After 24 hours you can check the repository for compliance at the Ministry of Justice GitHub Standards Report service: https://operations-engineering-reports-prod.cloud-platform.service.justice.gov.uk/home
Checklist Configure Repo
Checklist Onboard Repo
Configure Repo:
Create a new repository from MOJ “template-repository”
Go to the MOJ GitHub home https://github.com/ministryofjustice/
Select “template-repository” from the pinned
Then click on the green button on the right, labeled “Use this template”
Select “Create a new repository” from the drop down.
In the “Create a new repository” page under “Owner / Choose an Owner” select “ministryofjustice”.
Enter a description, while that’s optional it really should be filled out.
Select whether it should public, internal or private (chooses accordingly, default has been public.
Click the “Create repository” button.
Add the team as admins.
Add the team (current name nvvs-devops-admins) as admins.
- Click on “Settings” in the menu above the repository name (far right).
- Under “Access”, click on “Collaborators and teams”.
- Then click green button “Add teams”.
- Paste
nvvs-devops-admins
into the search box. - Select the team (similar named teams may show in the results).
- Select “Admin” for the role and click the green “Add ministryofjustice/nvvs-devops-admins”.
Remove your account as an admin (you will have access as a member of the team).
You should still be on same page/section from previous step. Remove your account as an admin, because you will have access as a member of the team. By leaving your account listed it creates confusion when you leave the team (leave MOJ or move to another team).
Branch protection rules
- Click on “Settings” in the menu above the repository name (far right).
- Under “Code and automation”, click on “Branches”.
- Click on “Add classic branch protection rule”.
- In the “Branch name pattern” box enter
main
. - Under “Protect matching branches”:
- Check “Require a pull request before merging”.
- Check “Require review from Code Owners”.
- Check “Do not allow bypassing the above settings”.
- Check “Restrict who can push to matching branches”, accept defaults offered.
- Click green “Create” button (or “Save changes if updating).
Issues enabled
- Click on "Settings” in the menu above the repository name (far right).
- This is the “General” section, scroll down to “Features”.
- Check the “Automatically delete head branches” box.
Automatically delete head branches
- Click on “Settings” in the menu above the repository name (far right).
- This is the “General” section, scroll down to “Pull Requests”.
- Check the “Issues” box.
[!NOTE] The following two configuration items need to be done on a branch then PR raised to merge.
Update CODEOWNERS file
- On a new branch edit the
.github/CODEOWNERS
file. - Delete the templated example.
- Paste
* @ministryofjustice/nvvs-devops-admins
- Save, Commit, Push branch.
- Raise PR and merge to
main
branch.
Update README
The README.md will need updating to reflect the purpose of the new repository and provide information useful to users. This could be done after all the other configuration and on-boarding steps have been completed.
Onboard Repo:
Add repository to “staff-technology-services-github-teams”
We need to add the repository to a list common_team_repositories_for_all_groups
in this Terraform code which manages the team’s access and ownership.
staff-technology-services-github-teams
In the file linked below: https://github.com/ministryofjustice/staff-technology-services-github-teams/blob/main/teams.tf
(This step solidifies the step that had been done by click ops in the second step of Configure Repo).
Update onboarding
The linuxify project used to quickly onboard a new engineer’s laptop (Mac) will require updating in two files
- Github Repos Bookmarks : https://github.com/ministryofjustice/linuxify/blob/main/github_bookmarks2.html
- Clone repos script: https://github.com/ministryofjustice/linuxify/blob/main/scripts/getrepos.sh adding the new repo to the list
Subscribe to Slack notifications.
We have a Slack channel “nvvs-devops-notifications” in which GitHub pull requests
, deployments
and releases
are posted automatically.
To add enter the following into that Slack channel:
/github subscribe ministryofjustice/replace-this-with-new-repo-name
And then follow the instructions to approve this in GitHub (have your 2FA ready).
Here you can also check existing subscriptions or unsubscribe
/github subscribe list
/github unsubscribe owner/repo
See following URL for more options and details: https://github.com/integrations/slack#subscribe-to-an-organization-or-a-repository