Skip to content

Periodic update of stubs from typeshed to PyPI #8222

Periodic update of stubs from typeshed to PyPI

Periodic update of stubs from typeshed to PyPI #8222

Workflow file for this run

name: Periodic update of stubs from typeshed to PyPI
on:
# Triggers the workflow each day at 02:00 UTC.
schedule:
- cron: 0 2 * * *
# If needed, allows to run this workflow manually from the Actions tab
workflow_dispatch:
env:
FORCE_COLOR: 1
jobs:
build-and-upload:
runs-on: ubuntu-latest
if: ${{ github.repository == 'typeshed-internal/stub_uploader' || github.event_name == 'workflow_dispatch' }}
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Checkout main
uses: actions/checkout@v4
with:
path: main
- name: Checkout typeshed
uses: actions/checkout@v4
with:
repository: python/typeshed
path: typeshed
# It is unlikely there will be more commits between two runs.
# We could set this to 0 to fetch everything, but we want this to be fast.
fetch-depth: 100
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r main/requirements.txt
- name: Execute diff build and upload tasks
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TYPESHED_BOT_API_TOKEN }}
run: |
cd main
python -m stub_uploader.upload_changed ../typeshed $(cat data/last_typeshed_commit.sha1)
(cd ../typeshed; git rev-parse HEAD) > data/last_typeshed_commit.sha1
if [ -z "$(git status --porcelain)" ]; then
exit 0;
fi
git config user.name github-actions && git config user.email github-actions@github.com
# This will also commit any new and changed changelogs.
git add . && git commit -m "Update last typeshed commit" && git push