Skip to content

Commit a0708b3

Browse files
🐞 fix: failed to create repo due to no commit
once -s . --push is specified, then we need make sure there's commit
1 parent a13c78a commit a0708b3

6 files changed

Lines changed: 10 additions & 28 deletions

File tree

.github/workflows/dev.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
# The type of runner that the job will run on
2222
strategy:
2323
matrix:
24-
python-versions: ['3.7', '3.8',' 3.9', '3.10']
24+
python-versions: ['3.7', '3.8', '3.9', '3.10']
2525
# github action doesn't goes well with windows due to docker support
2626
# github action doesn't goes well with macos due to `no docker command`
2727
#os: [ubuntu-20.04, windows-latest, macos-latest]
@@ -60,13 +60,14 @@ jobs:
6060
python -m pip install --upgrade pip
6161
pip install poetry tox tox-gh-actions
6262
63-
# declare env.package_version_full, env.package_name, env.package_version, env.repo_owner, env.repo_name, so you may use it in web hooks.
63+
# declare env.package_version, env.package_name, env.package_version, env.repo_owner, env.repo_name, so you may use it in web hooks.
6464
- name: Declare variables for convenient use
6565
run: |
6666
echo "package_version=`poetry version --short`.DEV.$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
67-
echo "package_name=`poetry version |awk '{print $1'}`" >> $GITHUB_ENV
67+
echo "package_name=`poetry version | awk '{print $1}'`" >> $GITHUB_ENV
6868
echo "repo_owner=${GITHUB_REPOSITORY%/*}" >> $GITHUB_ENV
6969
echo "repo_name=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
70+
shell: bash
7071

7172
- name: build documentation
7273
run: |

docs/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ This will give you a test report and a lint report. You should see no errors exc
148148
machine. Otherwise, remove it from tox.ini and pyproject.toml (search python3.x then
149149
remove it).
150150

151-
## Step 6: Create a GitHub Repo
151+
## Step 6: Create GitHub Repo
152152

153153
???+Info
154154
Going through step 6 and 7 is tedious. So that's why we provide a bash script --repo.sh, to help creating repo, setting secrets and publishing your code to the repo automatically.

hooks/post_gen_project.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#!/usr/bin/env python
22
import os
3-
import subprocess
43
import sys
5-
import asyncio
64
from hooks.aioproc import aioprocess, async_run
75
import colorama
86
from colorama import Fore, Style
@@ -58,7 +56,7 @@ def init_dev():
5856
print(Style.RESET_ALL, Style.DIM)
5957
try:
6058
execute(sys.executable, "-m", "pip", "install", "pre-commit")
61-
execute("pre-commit", "install", cwd=PROJECT_DIRECTORY)
59+
execute("pre-commit", "install", cwd="{{ cookiecutter.project_slug }}")
6260
print(Style.NORMAL, Fore.GREEN, "pre-commit hooks was successfully installed")
6361
print(Style.RESET_ALL)
6462
except Exception as e:
@@ -103,25 +101,6 @@ def init_dev():
103101
Style.RESET_ALL,
104102
)
105103

106-
try:
107-
print(Style.NORMAL, Fore.BLUE, "lint files...")
108-
print(Style.RESET_ALL, Style.DIM)
109-
execute("pre-commit", "run", "--all", cwd=PROJECT_DIRECTORY)
110-
print(
111-
Style.NORMAL,
112-
Fore.GREEN,
113-
"lint files successfully",
114-
Style.RESET_ALL
115-
)
116-
except Exception as e:
117-
print(e)
118-
print(
119-
Style.NORMAL,
120-
Fore.YELLOW,
121-
"error occurs when run command `pre-commit run --all`.",
122-
Style.RESET_ALL
123-
)
124-
125104

126105

127106
if __name__ == "__main__":

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ extra:
5555
link: https://zillionare.github.io/python-project-wizard
5656
name: Github
5757
- icon: material/email
58-
link: "mailto:code@example.com"
58+
link: "mailto:code@jieyu.ai"

{{cookiecutter.project_slug}}/.github/workflows/dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
python -m pip install --upgrade pip
7474
pip install poetry tox tox-gh-actions
7575
76-
# declare env.package_version_full, env.package_version, env.repo_owner, env.repo_name, env.package_name so you may use it in web hooks.
76+
# declare env.package_version, env.package_version, env.repo_owner, env.repo_name, env.package_name so you may use it in web hooks.
7777
- name: Declare variables for convenient use
7878
run: |
7979
echo "package_version=`poetry version --short`.DEV.$GITHUB_RUN_NUMBER" >> $GITHUB_ENV

{{cookiecutter.project_slug}}/repo.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
# uncomment the following to create repo and push code to github
88
# git add .
9+
# pre-commit run --all-files
10+
# git add .
911
# git commit -m "Initial commit by ppw"
1012
# gh repo create {{cookiecutter.project_slug}} --public -s . --push
1113

0 commit comments

Comments
 (0)