Skip to content

Commit

Permalink
Skip another prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
damccorm authored Nov 4, 2023
1 parent 7ea58e6 commit 7bea9bc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions release/src/main/scripts/download_github_actions_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ def parse_arguments():
artifacts_dir = args.artifacts_dir if os.path.isabs(args.artifacts_dir) \
else os.path.abspath(args.artifacts_dir)
rc_number = args.rc_number
skip_prompts = args.yes

return github_token, repo_url, rc_tag, release_commit, artifacts_dir, rc_number
return github_token, repo_url, rc_tag, release_commit, artifacts_dir, rc_number, skip_prompts


def get_github_token(github_token_var):
Expand Down Expand Up @@ -242,15 +243,15 @@ def wait_for_workflow_run_to_finish(
)


def prepare_directory(artifacts_dir):
def prepare_directory(artifacts_dir, skip_prompts):
"""Creates given directory and asks for confirmation if directory exists before clearing it."""
print(f"Preparing Artifacts directory: {artifacts_dir}")
if os.path.isdir(artifacts_dir):
question = (
f"Found that directory already exists.\n"
f"Any existing content in it will be erased. Proceed?\n"
f"Your answer")
if get_yes_or_no_answer(question):
if skip_prompts or get_yes_or_no_answer(question):
print(f"Clearing directory: {artifacts_dir}")
shutil.rmtree(artifacts_dir, ignore_errors=True)
else:
Expand Down Expand Up @@ -329,14 +330,15 @@ def extract_single_artifact(file_path, output_dir):
release_commit,
artifacts_dir,
rc_number,
skip_prompts,
) = parse_arguments()

try:
workflow_id = get_build_wheels_workflow_id(repo_url, github_token)
run_id = get_last_run_id(
workflow_id, repo_url, rc_tag, release_commit, github_token)
validate_run(run_id, repo_url, github_token)
prepare_directory(artifacts_dir)
prepare_directory(artifacts_dir, skip_prompts)
fetch_github_artifacts(run_id, repo_url, artifacts_dir, github_token, rc_number)
print("Script finished successfully!")
print(f"Artifacts available in directory: {artifacts_dir}")
Expand Down

0 comments on commit 7bea9bc

Please sign in to comment.