Skip to content

Commit bdff2a1

Browse files
Fix creating workflow if if directory .github/workflows already exists #298 (#312)
--------- Co-authored-by: Nicola Coretti <nicola.coretti@exasol.com>
1 parent e1b4e50 commit bdff2a1

File tree

7 files changed

+40
-3
lines changed

7 files changed

+40
-3
lines changed

doc/changes/unreleased.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@
4343

4444
* Fixed `index.rst` documentation template to provide the correct underlining length of the main heading
4545
* Added multi-version extension to Sphinx configuration of the project template
46+
* fixed bug in tbx worflow install error if directory exists[#298](https://github.com/exasol/python-toolbox/issues/298) also [#297](https://github.com/exasol/python-toolbox/issues/297)

exasol/toolbox/tools/template.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def install_template(template: str, dest: Path, pkg: str, template_type: str) ->
120120
Attention: If there is an existing template with the same name it will be overwritten!
121121
"""
122122
if not dest.exists():
123-
dest.mkdir()
123+
dest.mkdir(parents=True)
124124

125125
try:
126126
templates = _select_templates(template, pkg, template_type)
@@ -139,7 +139,7 @@ def update_template(
139139
) -> None:
140140
"""Similar to install but checks for existing templates and shows diff"""
141141
if not dest.exists():
142-
dest.mkdir()
142+
dest.mkdir(parents=True)
143143

144144
try:
145145
templates = _select_templates(template, pkg, template_type)

exasol/toolbox/tools/workflow.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ def install_workflow(
5656
5757
Attention: If there is an existing workflow with the same name it will be overwritten!
5858
"""
59-
dest.mkdir(parents=True)
6059
template.install_template(
6160
template=workflow, dest=dest, pkg=PKG, template_type=TEMPLATE_TYPE
6261
)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Create project directory
2+
$ mkdir .github
3+
$ mkdir -p .github/workflows
4+
5+
install issue
6+
$ tbx issue install bug
7+
Installed bug in .github/ISSUE_TEMPLATE/bug.md
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
install issue template
2+
$ tbx issue install feature
3+
Installed feature in .github/ISSUE_TEMPLATE/feature.md
4+
5+
install another issue template
6+
$ tbx issue install bug
7+
Installed bug in .github/ISSUE_TEMPLATE/bug.md
8+
9+
Install another issue template while an issue template with the same name already exists
10+
$ touch .github/ISSUE_TEMPLATE/refactoring.md
11+
$ tbx issue install refactoring
12+
Installed refactoring in .github/ISSUE_TEMPLATE/refactoring.md
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Create project directory
2+
$ mkdir -p .github/workflows
3+
4+
install workflow
5+
$ tbx workflow install pr-merge
6+
Installed pr-merge in .github/workflows/pr-merge.yml
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
install workflow
2+
$ tbx workflow install cd
3+
Installed cd in .github/workflows/cd.yml
4+
5+
install another workflow
6+
$ tbx workflow install checks
7+
Installed checks in .github/workflows/checks.yml
8+
9+
install workflow while a workflow with this name already exists
10+
$ touch .github/workflows/ci.yml
11+
$ tbx workflow install ci
12+
Installed ci in .github/workflows/ci.yml

0 commit comments

Comments
 (0)