github_actions_models/dependabot/
v2.rsuse indexmap::{IndexMap, IndexSet};
use serde::Deserialize;
#[derive(Deserialize, Debug)]
#[serde(rename_all = "kebab-case")]
pub struct Dependabot {
pub version: u64,
#[serde(default)]
pub enable_beta_ecosystems: bool,
#[serde(default)]
pub registries: IndexMap<String, Registry>,
pub updates: Vec<Update>,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "kebab-case", tag = "type")]
pub enum Registry {
ComposerRepository {
url: String,
username: Option<String>,
password: Option<String>,
},
DockerRegistry {
url: String,
username: Option<String>,
password: Option<String>,
#[serde(default)]
replaces_base: bool,
},
Git {
url: String,
username: Option<String>,
password: Option<String>,
},
HexOrganization {
organization: String,
key: Option<String>,
},
HexRepository {
repo: Option<String>,
url: String,
auth_key: Option<String>,
public_key_fingerprint: Option<String>,
},
MavenRepository {
url: String,
username: Option<String>,
password: Option<String>,
},
NpmRegistry {
url: String,
username: Option<String>,
password: Option<String>,
#[serde(default)]
replaces_base: bool,
},
NugetFeed {
url: String,
username: Option<String>,
password: Option<String>,
},
PythonIndex {
url: String,
username: Option<String>,
password: Option<String>,
#[serde(default)]
replaces_base: bool,
},
RubygemsServer {
url: String,
username: Option<String>,
password: Option<String>,
#[serde(default)]
replaces_base: bool,
},
TerraformRegistry {
url: String,
token: Option<String>,
},
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "kebab-case")]
pub struct Update {
#[serde(default)]
pub allow: Vec<Allow>,
#[serde(default)]
pub assignees: IndexSet<String>,
pub commit_message: Option<CommitMessage>,
pub directory: String,
#[serde(default)]
pub groups: IndexMap<String, Group>,
#[serde(default)]
pub ignore: Vec<Ignore>,
#[serde(default)]
pub insecure_external_code_execution: AllowDeny,
#[serde(default = "default_labels")]
pub labels: IndexSet<String>,
pub milestone: Option<u64>,
#[serde(default = "default_open_pull_requests_limit")]
pub open_pull_requests_limit: u64,
pub package_ecosystem: PackageEcosystem,
#[serde(default)]
pub rebase_strategy: RebaseStrategy,
#[serde(default, deserialize_with = "crate::common::scalar_or_vector")]
pub registries: Vec<String>,
#[serde(default)]
pub reviewers: IndexSet<String>,
pub schedule: Schedule,
pub target_branch: Option<String>,
#[serde(default)]
pub vendor: bool,
pub versioning_strategy: Option<VersioningStrategy>,
}
#[inline]
fn default_labels() -> IndexSet<String> {
IndexSet::from(["dependencies".to_string()])
}
#[inline]
fn default_open_pull_requests_limit() -> u64 {
5
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "kebab-case")]
pub struct Allow {
pub dependency_name: Option<String>,
pub dependency_type: Option<DependencyType>,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "kebab-case")]
pub enum DependencyType {
Direct,
Indirect,
All,
Production,
Development,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "kebab-case")]
pub struct CommitMessage {
pub prefix: Option<String>,
pub prefix_development: Option<String>,
pub include: Option<String>,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "kebab-case")]
pub struct Group {
pub dependency_type: Option<DependencyType>,
#[serde(default)]
pub patterns: IndexSet<String>,
#[serde(default)]
pub exclude_patterns: IndexSet<String>,
#[serde(default)]
pub update_types: IndexSet<UpdateType>,
}
#[derive(Deserialize, Debug, Hash, Eq, PartialEq)]
#[serde(rename_all = "kebab-case")]
pub enum UpdateType {
Major,
Minor,
Patch,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "kebab-case")]
pub struct Ignore {
pub dependency_name: Option<String>,
#[serde(default)]
pub update_types: IndexSet<String>,
#[serde(default)]
pub versions: IndexSet<String>,
}
#[derive(Deserialize, Debug, Default)]
#[serde(rename_all = "kebab-case")]
pub enum AllowDeny {
Allow,
#[default]
Deny,
}
#[derive(Deserialize, Debug, PartialEq)]
#[serde(rename_all = "kebab-case")]
pub enum PackageEcosystem {
Bundler,
Cargo,
Composer,
Docker,
Elm,
Gitsubmodule,
GithubActions,
Gomod,
Gradle,
Maven,
Mix,
Npm,
Nuget,
Pip,
Pub,
Swift,
Terraform,
}
#[derive(Deserialize, Debug, Default, PartialEq)]
#[serde(rename_all = "kebab-case")]
pub enum RebaseStrategy {
#[default]
Auto,
Disabled,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "kebab-case")]
pub struct Schedule {
pub interval: Interval,
pub day: Option<Day>,
pub time: Option<String>,
pub timezone: Option<String>,
}
#[derive(Deserialize, Debug, PartialEq)]
#[serde(rename_all = "kebab-case")]
pub enum Interval {
Daily,
Weekly,
Monthly,
}
#[derive(Deserialize, Debug, PartialEq)]
#[serde(rename_all = "kebab-case")]
pub enum Day {
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday,
}
#[derive(Deserialize, Debug, PartialEq)]
#[serde(rename_all = "kebab-case")]
pub enum VersioningStrategy {
Auto,
Increase,
IncreaseIfNecessary,
LockfileOnly,
Widen,
}