Skip to content

Commit

Permalink
Fix string format
Browse files Browse the repository at this point in the history
  • Loading branch information
another-rex committed Aug 9, 2024
1 parent 0a2277a commit dd8ff8f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions update-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@


def cmd(command: list[str]) -> str:
print('$ %s', ' '.join(command))
print('$ ' + ' '.join(command))
process = subprocess.run(command, capture_output=True, text=True)
if process.returncode != 0:
print('failed to run above command, got exit code: %d', process.returncode)
print('stderr: %s', process.stderr.strip())
print('stderr: ' + process.stderr.strip())
exit(process.returncode)

output = process.stdout.strip()
print('# %s', output)
print('# ' + output)
return output


def find_and_replace_regex_in_file(file_path: str, find_regex: str,
replace: str):

print('Performing find and replace on "%s": s/%s/%s', file_path, find_regex, replace)
print(f'Performing find and replace on "{file_path}": s/{find_regex}/{replace}')
# Read in the file
with open(file_path, 'r') as file:
filedata = file.read()
Expand Down Expand Up @@ -81,7 +81,7 @@ def print_help():
])

first_commit_hash = cmd(['git', 'rev-parse', 'HEAD'])
print('First commit hash: %s', first_commit_hash)
print('First commit hash: ' + first_commit_hash)

find_and_replace_regex_in_file(
'.github/workflows/osv-scanner-reusable.yml',
Expand All @@ -101,7 +101,7 @@ def print_help():
])

second_commit_hash = cmd(['git', 'rev-parse', 'HEAD'])
print('Second commit hash: %s', second_commit_hash)
print('Second commit hash: ' + second_commit_hash)

find_and_replace_regex_in_file(
'.github/workflows/osv-scanner-unified-workflow.yml',
Expand Down

0 comments on commit dd8ff8f

Please sign in to comment.