File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,11 @@ name: Generate stdlib lists
2
2
3
3
on :
4
4
workflow_dispatch :
5
+ inputs :
6
+ dry-run :
7
+ description : " Don't create any PRs for this run"
8
+ type : boolean
9
+ default : false
5
10
schedule :
6
11
- cron : " 0 0 * * 2"
7
12
@@ -95,13 +100,20 @@ jobs:
95
100
- name : walk modules
96
101
env :
97
102
LISTGEN_PYTHON_VERSION : ${{ matrix.python }}
103
+ LISTGEN_DRY_RUN : ${{ inputs.dry-run }}
98
104
run : |
99
105
python -V
100
106
python ./support/walk-modules.py "${LISTGEN_PYTHON_VERSION}.txt"
101
107
sort -o "${LISTGEN_PYTHON_VERSION}.txt" "${LISTGEN_PYTHON_VERSION}.txt"
102
- mv "${LISTGEN_PYTHON_VERSION}.txt" ./stdlib_list/lists/
108
+
109
+ if [[ "${LISTGEN_DRY_RUN}" == "true" ]]; then
110
+ diff ./stdlib_list/lists/"${LISTGEN_PYTHON_VERSION}.txt" "${LISTGEN_PYTHON_VERSION}.txt"
111
+ else
112
+ mv "${LISTGEN_PYTHON_VERSION}.txt" ./stdlib_list/lists/
113
+ fi
103
114
104
115
- name : create PR
116
+ if : ${{ !inputs.dry-run }}
105
117
uses : peter-evans/create-pull-request@v5
106
118
with :
107
119
commit-message : " [BOT] update list for ${{ matrix.python }}"
Original file line number Diff line number Diff line change @@ -83,4 +83,9 @@ def walk(mod_name, io):
83
83
walk (mod_name , io )
84
84
else :
85
85
for mod_name in sys .stdin :
86
+ # Our precomputed list might not start at the root, since it
87
+ # might be a package rather than a module.
88
+ if "." in mod_name :
89
+ top_mod = mod_name .split ("." )[0 ]
90
+ walk (top_mod , io )
86
91
walk (mod_name .rstrip ("\n " ), io )
You can’t perform that action at this time.
0 commit comments