Skip to content

Repository

Definition of a Repository for a GitHub organization, the following properties are supported:

Key Value Description Notes
name string Name of the repository
aliases list[string] List of repository alias names, need to add previous name when renaming a repository
description string or null Project description
homepage string or null Link to the homepage
topics list[string] The list of topics of this repository
private boolean If the project is private
archived boolean If the repo is archived
allow_auto_merge boolean If auto merges are permitted
allow_forking boolean If the repo allows private forking
allow_merge_commit boolean If merge commits are permitted
allow_rebase_merge boolean If rebase merges are permitted
allow_squash_merge boolean If squash merges are permitted
allow_update_branch boolean If pull requests should suggest updates
auto_init boolean If the repository shall be auto-initialized during creation only considered during creation
default_branch string Name of the default branch
delete_branch_on_merge boolean If branches shall automatically be deleted after a merge
dependabot_alerts_enabled boolean If the repo has dependabot alerts enabled
dependabot_security_updates_enabled boolean If the repo has dependabot security updates enabled
gh_pages_build_type string If the repo has GitHub Pages enabled disabled, legacy or workflow. Build-type legacy refers to building from a branch
gh_pages_source_branch string or null The branch from which GitHub Pages should be built only taken into account when gh_pages_build_type is set to legacy
gh_pages_source_path string or null The folder from which GitHub Pages should be built only taken into account when gh_pages_build_type is set to legacy
has_discussions boolean If the repo has discussions enabled
has_issues boolean If the repo can have issues
has_projects boolean If the repo can have projects
has_wiki boolean If the repo has a wiki
is_template boolean If the repo is can be used as a template repository
merge_commit_message string Can be PR_BODY, PR_TITLE, or BLANK for a default merge commit message
merge_commit_title string Can be PR_TITLE or MERGE_MESSAGE for a default merge commit title
post_process_template_content list[string] A list of content paths in a template repository that shall be processed after creation only considered during creation
private_vulnerability_reporting_enabled boolean If the repo has private vulnerability reporting enabled
secret_scanning string If secret scanning is "enabled" or "disabled"
secret_scanning_push_protection string If secret scanning push protection is "enabled" or "disabled"
squash_merge_commit_message string Can be PR_BODY, COMMIT_MESSAGES, or BLANK for a default squash merge commit message
squash_merge_commit_title string Can be PR_TITLE or COMMIT_OR_PR_TITLE for a default squash merge commit title
template_repository string or null The template repository to use when creating the repo read-only, only considered during creation
forked_repository string or null The repository to fork when creating the repo only considered during creation
fork_default_branch_only boolean When creating a fork, whether only the default branch will be included in the fork only considered during creation
web_commit_signoff_required boolean If the repo requires web commit signoff
workflows WorkflowSettings Workflow settings on organizational level
webhooks list[Webhook] webhooks defined for this repo, see section above for details
secrets list[RepositorySecret] secrets defined for this repo, see section below for details
variables list[RepositoryVariable] variables defined for this repo, see section below for details
environments list[Environment] environments defined for this repo, see section below for details
branch_protection_rules list[BranchProtectionRule] branch protection rules of the repo, see section below for details

Jsonnet Function

orgs.newRepo('<name>') {
  <key>: <value>
}
orgs.extendRepo('<name>') {
  <key>: <value>
}

Note

In general, you will only ever use orgs.newRepo as this function will define a new repository with default values. However, in some cases it might be needed to change properties for a repo that has already been defined in the default configuration. In such situation, you should use orgs.extendRepo.

Validation rules

  • TODO: complete

  • specifying a description of more than 350 characters triggers an error (maximum supported length by GitHub)

  • specifying more than 20 topics triggers an error (maximum number of supported topics by GitHub)
  • disabling has_discussions while this repository is configured as source repository for discussion of this organization triggers an error
  • specifying a template_repository and forked_repository at the same time triggers an error

Note

When enabling GitHub Pages by setting gh_pages_build_type to either legacy or workflow, you should also define a github-pages environment, as it will be created automatically by GitHub.

Example usage

orgs.newOrg('adoptium') {
  ...
  _repositories+:: [
    ...
    orgs.newRepo('.github') {
      allow_auto_merge: true,
      allow_merge_commit: false,
      allow_update_branch: false,
      dependabot_alerts_enabled: false,
      web_commit_signoff_required: false,
      branch_protection_rules: [
        orgs.newBranchProtectionRule('main'),
      ],
    },
}