Skip to content

Pipx Check Versions #27

Pipx Check Versions

Pipx Check Versions #27

---
name: Pipx Check Versions
on:
schedule:
- cron: "0 0 1 * *"
workflow_dispatch:
permissions: {}
defaults:
run:
working-directory: yaml
jobs:
npm-check-versions:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 1
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: 3.14
- name: Check outdated dependencies
shell: bash
run: |
set -euo pipefail
IFS=$'\n\t'
rc=0
# Read each line from requirements.txt
while IFS= read -r line; do
# Skip empty lines and comments
if [[ -z "$line" || "$line" =~ ^# ]]; then
continue
fi
# Extract package name and current version
if [[ "$line" =~ ^([a-zA-Z0-9_-]+)==([0-9.]+) ]]; then
package="${BASH_REMATCH[1]}"
current_version="${BASH_REMATCH[2]}"
# Get latest version from PyPI using pip index versions
# The version in parentheses on the first line is the latest
latest_version="$(\pip index versions "${package}" 2>/dev/null | { \grep -e '^Available versions: ' || true; } | \cut -d ',' -f 1 | \sed -e 's/^.*: //')"
if [ "${current_version}" != "${latest_version}" ]; then
echo "${package}: ${current_version} -> ${latest_version}"
rc=$((rc+1))
fi
fi
done < requirements.txt
exit ${rc}