feature/dry-run #43

Merged
kjuulh merged 1 commits from feature/dry-run into main 2022-12-01 09:14:02 +01:00
5 changed files with 24 additions and 16 deletions

View File

@ -1,12 +1,12 @@
apiVersion: action
name: write-a-readme
select:
github:
repositories:
- kjuulh/octopush-test
push:
pull-request:
name: "write a readme"
# github:
# repositories:
# - kjuulh/octopush-test
# push:
# pull-request:
# name: "write a readme"
gitea:
repositories:
@ -15,12 +15,12 @@ select:
pull-request:
name: "write a readme"
git:
repositories:
- git@git.front.kjuulh.io:kjuulh/octopush-test.git
push:
branch:
name: "write a readme"
# git:
# repositories:
# - git@git.front.kjuulh.io:kjuulh/octopush-test.git
# push:
# branch:
# name: "write a readme"
action:
type: go
entry: "main.go"

View File

@ -63,6 +63,7 @@ pub fn execute_cmd() -> Command {
.long("dry-run")
.action(ArgAction::Set)
.env("OCTOPUSH_DRY_RUN")
.default_value("true")
.required(false),
)
}
@ -78,7 +79,14 @@ pub async fn execute_subcommand(args: &ArgMatches) -> eyre::Result<()> {
let github_http_token = args.get_one::<String>("github-api-token");
let github_username = args.get_one::<String>("github-username");
let dryrun = args.get_one::<bool>("dry-run").unwrap_or(&false).clone();
let dryrun: bool = args
.get_one::<String>("dry-run")
.ok_or(eyre::anyhow!("--dry-run is required"))?
.parse()?;
if dryrun {
tracing::info!("running in dry-run mode");
}
let service_register = ServiceRegister::new(
LocalGitProviderOptions { http_auth: None },

View File

@ -43,7 +43,7 @@ impl GitSelector {
self.executor.execute(&path, action_path, action).await?;
if dryrun {
return Ok(());
continue;
}
if let Some(push) = &git.push {

View File

@ -49,7 +49,7 @@ impl GiteaSelector {
self.executor.execute(&path, action_path, action).await?;
if dryrun {
return Ok(());
continue;
}
if let Some(push) = &git.push {

View File

@ -49,7 +49,7 @@ impl GitHubSelector {
self.executor.execute(&path, action_path, action).await?;
if dryrun {
return Ok(());
continue;
}
if let Some(push) = &git.push {