1
+ name : Generate default project template
2
+
3
+ on :
4
+ workflow_call :
5
+ inputs :
6
+ repo-path :
7
+ required : true
8
+ type : string
9
+ repo-user :
10
+ required : true
11
+ type : string
12
+ repo-email :
13
+ required : true
14
+ type : string
15
+ cookiecutter-profile :
16
+ required : true
17
+ type : string
18
+ secrets :
19
+ repo-token :
20
+ required : true
21
+
22
+ jobs :
23
+ validate-instance :
24
+ runs-on : ubuntu-latest
25
+ container : python:3.11
26
+ permissions :
27
+ contents : read
28
+ pages : write
29
+ env :
30
+ TEST_REPO_TOKEN : ${{ secrets.repo-token }}
31
+
32
+ steps :
33
+ - uses : actions/checkout@v4
34
+
35
+ - name : Cache Dependencies
36
+ uses : actions/cache@v4
37
+ with :
38
+ path : ~/.cache/pip
39
+ key : ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
40
+ restore-keys : |
41
+ ${{ runner.os }}-pip-
42
+
43
+ - name : Install Dependencies
44
+ run : pip install -r requirements.txt
45
+
46
+ - name : Create Github project instance
47
+ run : cookiecutter . --no-input --config-file ${{ inputs.cookiecutter-profile }}
48
+
49
+ - name : Remote checkout
50
+ run : |
51
+ git clone https://oauth2:${{ env.TEST_REPO_TOKEN }}@github.com/{inputs.repo-path} ds-default-repo
52
+ cp -r ds-default/. ds-default-repo
53
+
54
+ - name : Set safe directory
55
+ run : |
56
+ git config --global --add safe.directory /__w/ds-template/ds-template
57
+
58
+ - name : Prepare local git repo
59
+ working-directory : ./ds-default-repo
60
+ run : |
61
+ git config --local user.email ${{ inptus.repo-email }}
62
+ git config --local user.name ${{ inputs.repo-user }}
63
+ git checkout -b ds-default-check
64
+ git add .
65
+
66
+ - name : Validate package build
67
+ working-directory : ./ds-default-repo
68
+ run : |
69
+ python -m pip install .
70
+
71
+ - name : Install pre-commit
72
+ run : pip3 install pre-commit
73
+
74
+ - name : Run pre-commit checks
75
+ working-directory : ./ds-default-repo
76
+ run : pre-commit run --all-files --show-diff-on-failure --color always
77
+
78
+ - name : Push repo
79
+ working-directory : ./ds-default-repo
80
+ run : |
81
+ git commit -m "Repo after creation"
82
+ git push --set-upstream origin ds-default-check -f
0 commit comments