GitHub repository medium builtIn

Description

The repository default branch name should be 'main'. This policy will ensure naming convention is consistent across each repository. You can change the default branch for a particular repository at any time. The default branch is considered the base branch in your repository, against which all pull requests and code commits are automatically made, unless you specify a different branch. Learn more: https://docs.github.com/en/enterprise-cloud@latest/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/changing-the-default-branch

Recommendation

1. Navigate to Repository Settings. 
2. In the 'General' section of the sidebar, go to 'Default branch' section. 
3. Ensure 'main' is the default branch. 
4. Navigate to 'Code' and click on the View all branches. 
5. Ensure the 'Default' branch is the 'main' branch.

Policy Rule

{
  "target": "GHRepository",
  "if": {
    "allOf": [
      {
        "resource": "GHRepository",
        "property": "DefaultBranchName",
        "operator": "match",
        "value": "$(GH_POLICY_VAR_REPO_DEFAULT_BRANCH_PATTERNS)"
      }
    ]
  },
  "then": {
    "effect": "Audit"
  }
}