with dry-run mode (#42)

Co-authored-by: kjuulh <contact@kjuulh.io>
Reviewed-on: #42
This commit is contained in:
2022-12-01 07:44:58 +00:00
parent ef28a7a248
commit e0d0077109
4 changed files with 32 additions and 4 deletions

View File

@@ -21,7 +21,13 @@ impl GitSelector {
}
}
pub async fn run(&self, git: &Git, action_path: &PathBuf, action: &Action) -> eyre::Result<()> {
pub async fn run(
&self,
git: &Git,
action_path: &PathBuf,
action: &Action,
dryrun: bool,
) -> eyre::Result<()> {
tracing::info!("fetching repos");
for repo in &git.repositories {
let gp = self.git_provider.clone();
@@ -36,6 +42,10 @@ impl GitSelector {
self.executor.execute(&path, action_path, action).await?;
if dryrun {
return Ok(());
}
if let Some(push) = &git.push {
self.git_provider
.push_branch(repo, &push.branch.name)

View File

@@ -32,6 +32,7 @@ impl GiteaSelector {
git: &Gitea,
action_path: &PathBuf,
action: &Action,
dryrun: bool,
) -> eyre::Result<()> {
tracing::info!("fetching repos");
for repo in &git.repositories {
@@ -47,6 +48,10 @@ impl GiteaSelector {
self.executor.execute(&path, action_path, action).await?;
if dryrun {
return Ok(());
}
if let Some(push) = &git.push {
self.git_provider
.push_branch(repo, &push.pull_request.name)

View File

@@ -32,6 +32,7 @@ impl GitHubSelector {
git: &GitHub,
action_path: &PathBuf,
action: &Action,
dryrun: bool,
) -> eyre::Result<()> {
tracing::info!("fetching repos");
for repo in &git.repositories {
@@ -47,6 +48,10 @@ impl GitHubSelector {
self.executor.execute(&path, action_path, action).await?;
if dryrun {
return Ok(());
}
if let Some(push) = &git.push {
self.git_provider
.push_branch(repo, &push.pull_request.name)