Skip to content

Use ruff formatter instead of black #4

Use ruff formatter instead of black

Use ruff formatter instead of black #4

name: Validate requirements.txt
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
validate-dependencies:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: fetch all history
run: git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
- name: check for changes in pyproject.toml and poetry.lock
id: check-deps
run: |
echo "Checking pyproject.toml and poetry.lock for changes..."
BASE_BRANCH=${{ github.event.pull_request.base.ref }}
HEAD_BRANCH=${{ github.event.pull_request.head.ref }}
CHANGES=$(git diff --name-only origin/$BASE_BRANCH -- origin/$HEAD_BRANCH | grep -E "^(pyproject.toml|poetry.lock)$" || true)
echo "Changed files: $CHANGES"
if [ ! -z "$CHANGES" ]; then
echo "Checking if requirements.txt has also been updated..."
if ! git diff --name-only origin/$BASE_BRANCH -- origin/$HEAD_BRANCH | grep -q "requirements.txt"; then
echo "ERROR: pyproject.toml or poetry.lock has changed, but requirements.txt has not been updated."
echo "Please update requirements.txt by running 'make create-requirements'."
exit 1
fi
fi
- name: validate requirements.txt update
if: steps.check-deps.outputs.poetry_updated == 'true'
run: |
BASE_BRANCH=${{ github.event.pull_request.base.ref }}
HEAD_BRANCH=${{ github.event.pull_request.head.ref }}
REQUIREMENTS_CHANGE=$(git diff --name-only origin/$BASE_BRANCH -- origin/$HEAD_BRANCH | grep -q "requirements.txt")
echo "requirements.txt changed: $REQUIREMENTS_CHANGE"
if [ ! -z "$REQUIREMENTS_CHANGE" ]; then
echo "requirements.txt updated correctly."
else
echo "ERROR: pyproject.toml or poetry.lock has changed, but requirements.txt has not been updated."
echo "Please update requirements.txt by running 'make create-requirements'."
exit 1
fi