Skip to content

Instantly share code, notes, and snippets.

@garysassano
Created May 7, 2024 23:04
Show Gist options
  • Save garysassano/1f67a9e1fa24e3a2aebe97770d61d15e to your computer and use it in GitHub Desktop.
Save garysassano/1f67a9e1fa24e3a2aebe97770d61d15e to your computer and use it in GitHub Desktop.
module RepositoriesConfig {
// Define a class for repository options
class RepositoryOptions {
visibility: String;
is_template: Boolean;
gitignore_template: String?;
license_template: String?;
template: Template?;
}
// Define a class for the template repository
class Template {
owner: String?;
repository: String?;
include_all_branches: Boolean;
}
// Define a class for main branch options
class MainBranchOptions {
require_signed_commits: Boolean;
required_linear_history: Boolean;
}
// Define a class for the repository schema
class RepositorySchema {
repository_options: RepositoryOptions;
main_branch_options: MainBranchOptions;
}
// Define a class for the entire configuration
class Configuration {
defaults: List<RepositorySchema>;
repositories: Map<String, RepositorySchema>;
}
// Example instance of the Configuration class with actual values
let config = Configuration {
defaults = [
RepositorySchema {
repository_options = RepositoryOptions {
visibility = "private",
is_template = false,
gitignore_template = null,
license_template = null,
template = Template {
owner = null,
repository = null,
include_all_branches = false
}
},
main_branch_options = MainBranchOptions {
require_signed_commits = false,
required_linear_history = false
}
}
],
repositories = {
"repo1" = RepositorySchema {
repository_options = RepositoryOptions {
visibility = "public",
is_template = true,
gitignore_template = "node",
license_template = "mit"
},
main_branch_options = MainBranchOptions {
require_signed_commits = true,
required_linear_history = true
}
},
"repo2" = RepositorySchema {
repository_options = RepositoryOptions {
visibility = "private",
is_template = false,
},
main_branch_options = MainBranchOptions {
require_signed_commits = false,
required_linear_history = false
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment