Skip to content

latest pins

latest pins #668

Workflow file for this run

name: "latest pins"
on:
workflow_dispatch:
schedule:
- cron: '25 4,16 * * *'
jobs:
update_pins:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: main
- uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install poetry from PyPI
uses: install-pinned/poetry@d95a199a06c2eb4e23169dd4f7139bb645b9dbe2 # 1.3.2
- run: poetry init --name lockenv --python "^3.8" --directory ${{ runner.temp }} --no-interaction
- name: "Run poetry add yesqa ..."
shell: python
run: |
import re
import subprocess
def add(pyver: str):
subprocess.run([
"poetry", "add",
"--directory", "${{ runner.temp }}",
"--no-interaction",
"--lock",
"--python", pyver,
"yesqa"
], check=True, capture_output=True, text=True)
try:
add("*")
except subprocess.CalledProcessError as e:
if (m := re.search(r'set the `python` property to "(.+?)"', e.stderr)) is None:
raise
print(f"Retrying with --python {m[1]}...")
try:
add(m[1])
except subprocess.CalledProcessError as e:
if (m := re.search(r'set the `python` property to "(.+?)"', e.stderr)) is None:
raise
print(f"Retrying with --python {m[1]}...")
# We need to retry twice for some projects.
add(m[1])
- run: poetry export -o requirements.txt --directory ${{ runner.temp }} --no-interaction
- run: |
if [ -n "$(git status --porcelain)" ]; then
git config --global user.name "install-pinned bot"
git config --global user.email "[email protected]"
git add --all
ver=$(curl -Ls https://pypi.org/pypi/yesqa/json | jq -r .info.version)
git commit -m "update pins (yesqa $ver)"
commit=$(git rev-parse HEAD)
sed -i -E "s/@[0-9a-f]{40}.*/@$commit # $ver/g" README.md
git commit -am "update README.md (yesqa $ver)"
git push
fi