diff --git a/.github/workflows/update-requirements.yml b/.github/workflows/update-requirements.yml new file mode 100644 index 000000000..8b4c094fd --- /dev/null +++ b/.github/workflows/update-requirements.yml @@ -0,0 +1,54 @@ + +# This is a basic workflow to run unit tests + +name: Update Requirements + +on: + push: + paths: + - pyproject.toml + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.8] + steps: + # Checkout + - name: Checkout code + uses: actions/checkout@v2 + + # Check commit message + - id: check + run: | + MESSAGE=$(git log -1 --pretty=%B) + if [[ "$MESSAGE" == *"[skip ci]"* ]]; then + echo "::set-output name=skip::true" + else + echo "::set-output name=skip::false" + fi + + # If commit message doesn't contain "[skip ci]", continue to the next steps + - name: Set up Python + if: steps.check.outputs.skip != 'true' + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + - name: Install Dependencies + if: steps.check.outputs.skip != 'true' + run: | + python -m pip install --upgrade pip + pip install poetry + + - name: Bump version, update requirements.txt and set output + if: steps.check.outputs.skip != 'true' + id: bump_version_and_set_output + run: | + poetry export --without-hashes --format=requirements.txt > requirements.txt + git checkout main + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add pyproject.toml requirements.txt + git commit -m "Update requirements.txt [skip ci]"