Skip to content

Commit 17eea4f

Browse files
committed
update-deps.py: Do not change directory for git commands
Use `-C` option instead. Also we no longer need to set commit author in command, because it will be set by workflow. Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
1 parent 582b3ad commit 17eea4f

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

.github/workflows/update-deps.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,23 @@
1313
DEPS_PACKAGING = "deps-packaging"
1414

1515

16-
def run_command(root: str, cmd: list):
17-
curdir = os.getcwd()
18-
os.chdir(root)
19-
16+
def run_command(cmd: list):
2017
try:
21-
log.debug(f"Running command '{" ".join(cmd)}' from directory '{root}'")
18+
log.debug(f"Running command '{" ".join(cmd)}'")
2219
subprocess.run(cmd, check=True)
2320
except subprocess.CalledProcessError:
2421
log.error(f"Command '{" ".join(cmd)}' failed")
2522
return False
26-
finally:
27-
os.chdir(curdir)
2823
return True
2924

3025

3126
def git_commit(root, msg):
32-
return run_command(root, ["git", "add", "-u"]) and run_command(
33-
root,
27+
return run_command(["git", "-C", root, "add", "-u"]) and run_command(
3428
[
3529
"git",
3630
"-C",
3731
root,
3832
"commit",
39-
"--author=GitHub <noreply@github.com>",
4033
f"--message={msg}",
4134
],
4235
)

0 commit comments

Comments
 (0)