Skip to content

Commit 5026214

Browse files
authored
listgen: merge list instead of overwriting (#81)
* listgen: merge list instead of overwriting * listgen: fix paths
1 parent 9180ec0 commit 5026214

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

.github/workflows/listgen.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,35 @@ jobs:
5353

5454
steps:
5555
- uses: actions/checkout@v3
56+
5657
- uses: actions/setup-python@v4
5758
with:
5859
python-version: ${{ matrix.python }}
60+
5961
- uses: actions/download-artifact@v3
6062
with:
6163
name: pre-list-${{ matrix.python }}
64+
6265
- name: walk modules
6366
env:
6467
LISTGEN_PYTHON_VERSION: ${{ matrix.python }}
68+
LISTGEN_DRY_RUN: ${{ inputs.dry-run }}
6569
run: |
66-
python -V
6770
python ./support/walk-modules.py "${LISTGEN_PYTHON_VERSION}.txt" < pre-list.txt
6871
rm pre-list.txt
69-
sort -o "${LISTGEN_PYTHON_VERSION}.txt" "${LISTGEN_PYTHON_VERSION}.txt"
70-
mv "${LISTGEN_PYTHON_VERSION}.txt" ./stdlib_list/lists/
72+
73+
sort -u -o ./stdlib_list/lists/"${LISTGEN_PYTHON_VERSION}.txt" \
74+
./stdlib_list/lists/"${LISTGEN_PYTHON_VERSION}.txt" \
75+
"${LISTGEN_PYTHON_VERSION}.txt"
76+
77+
rm "${LISTGEN_PYTHON_VERSION}.txt"
78+
79+
if [[ "${LISTGEN_DRY_RUN}" == "true" ]]; then
80+
git diff
81+
fi
82+
7183
- name: create PR
84+
if: ${{ !inputs.dry-run }}
7285
uses: peter-evans/create-pull-request@v5
7386
with:
7487
commit-message: "[BOT] update list for ${{ matrix.python }}"
@@ -94,22 +107,26 @@ jobs:
94107

95108
steps:
96109
- uses: actions/checkout@v3
110+
97111
- uses: actions/setup-python@v4
98112
with:
99113
python-version: ${{ matrix.python }}
114+
100115
- name: walk modules
101116
env:
102117
LISTGEN_PYTHON_VERSION: ${{ matrix.python }}
103118
LISTGEN_DRY_RUN: ${{ inputs.dry-run }}
104119
run: |
105-
python -V
106120
python ./support/walk-modules.py "${LISTGEN_PYTHON_VERSION}.txt"
107-
sort -o "${LISTGEN_PYTHON_VERSION}.txt" "${LISTGEN_PYTHON_VERSION}.txt"
121+
122+
sort -u -o ./stdlib_list/lists/"${LISTGEN_PYTHON_VERSION}.txt" \
123+
./stdlib_list/lists/"${LISTGEN_PYTHON_VERSION}.txt" \
124+
"${LISTGEN_PYTHON_VERSION}.txt"
125+
126+
rm "${LISTGEN_PYTHON_VERSION}.txt"
108127
109128
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/
129+
git diff
113130
fi
114131
115132
- name: create PR

0 commit comments

Comments
 (0)