Generate stdlib lists #112
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate stdlib lists | |
on: | |
workflow_dispatch: | |
inputs: | |
dry-run: | |
description: "Don't create any PRs for this run" | |
type: boolean | |
default: false | |
schedule: | |
- cron: "0 0 * * 2" | |
jobs: | |
pre-list-legacy: | |
strategy: | |
matrix: | |
python: | |
- "3.9" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
# NOTE: matrix.python is intentionally not used here. | |
python-version: "3.x" | |
- name: support deps | |
run: make dev INSTALL_EXTRA=support | |
- name: build pre-list | |
env: | |
LISTGEN_PYTHON_VERSION: "${{ matrix.python }}" | |
run: | | |
./env/bin/python ./support/fetch-sphinx.py "${LISTGEN_PYTHON_VERSION}" > pre-list.txt | |
- name: upload pre-list | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pre-list-${{ matrix.python }} | |
path: pre-list.txt | |
expand-list-legacy: | |
needs: pre-list-legacy | |
strategy: | |
matrix: | |
python: | |
- "3.7" | |
- "3.8" | |
- "3.9" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: pre-list-${{ matrix.python }} | |
- name: walk modules | |
env: | |
LISTGEN_PYTHON_VERSION: ${{ matrix.python }} | |
LISTGEN_DRY_RUN: ${{ inputs.dry-run }} | |
run: | | |
python ./support/walk-modules.py "${LISTGEN_PYTHON_VERSION}.txt" < pre-list.txt | |
rm pre-list.txt | |
if [[ -f "./stdlib_list/lists/"${LISTGEN_PYTHON_VERSION}.txt"" ]]; then | |
sort -u -o ./stdlib_list/lists/"${LISTGEN_PYTHON_VERSION}.txt" \ | |
./stdlib_list/lists/"${LISTGEN_PYTHON_VERSION}.txt" \ | |
"${LISTGEN_PYTHON_VERSION}.txt" | |
else | |
sort -u -o ./stdlib_list/lists/"${LISTGEN_PYTHON_VERSION}.txt" \ | |
"${LISTGEN_PYTHON_VERSION}.txt" | |
fi | |
rm "${LISTGEN_PYTHON_VERSION}.txt" | |
if [[ "${LISTGEN_DRY_RUN}" == "true" ]]; then | |
git diff | |
fi | |
- name: create PR | |
if: ${{ !inputs.dry-run }} | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
commit-message: "[BOT] update list for ${{ matrix.python }}" | |
branch: update-stdlib-list-${{ matrix.python }} | |
base: main | |
branch-suffix: timestamp | |
title: "[BOT] update list for ${{ matrix.python }}" | |
body: | | |
This is an automated pull request, updating `${{ matrix.python }}.txt` after a detected change. | |
Please review manually before merging. | |
assignees: "woodruffw" | |
reviewers: "woodruffw" | |
expand-list: | |
strategy: | |
matrix: | |
python: | |
- "3.10" | |
- "3.11" | |
- "3.12" | |
- "3.13" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: walk modules | |
env: | |
LISTGEN_PYTHON_VERSION: ${{ matrix.python }} | |
LISTGEN_DRY_RUN: ${{ inputs.dry-run }} | |
run: | | |
python ./support/walk-modules.py "${LISTGEN_PYTHON_VERSION}.txt" | |
if [[ -f "./stdlib_list/lists/"${LISTGEN_PYTHON_VERSION}.txt"" ]]; then | |
sort -u -o ./stdlib_list/lists/"${LISTGEN_PYTHON_VERSION}.txt" \ | |
./stdlib_list/lists/"${LISTGEN_PYTHON_VERSION}.txt" \ | |
"${LISTGEN_PYTHON_VERSION}.txt" | |
else | |
sort -u -o ./stdlib_list/lists/"${LISTGEN_PYTHON_VERSION}.txt" \ | |
"${LISTGEN_PYTHON_VERSION}.txt" | |
fi | |
rm "${LISTGEN_PYTHON_VERSION}.txt" | |
if [[ "${LISTGEN_DRY_RUN}" == "true" ]]; then | |
git diff | |
fi | |
- name: create PR | |
if: ${{ !inputs.dry-run }} | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
commit-message: "[BOT] update list for ${{ matrix.python }}" | |
branch: update-stdlib-list-${{ matrix.python }} | |
base: main | |
branch-suffix: timestamp | |
title: "[BOT] update list for ${{ matrix.python }}" | |
body: | | |
This is an automated pull request, updating `${{ matrix.python }}.txt` after a detected change. | |
Please review manually before merging. | |
assignees: "woodruffw" | |
reviewers: "woodruffw" |