This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 ${{ github.ref }} | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add requirements.txt | |
git commit -m "Update requirements.txt [skip ci]" |