Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
platonfloria committed Apr 26, 2024
1 parent c59f9d7 commit ad2c79d
Show file tree
Hide file tree
Showing 3 changed files with 360 additions and 1 deletion.
61 changes: 61 additions & 0 deletions .github/workflows/update-requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

# 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: Update requirements.txt
if: steps.check.outputs.skip != 'true'
id: bump_version_and_set_output
run: |
poetry export --without-hashes --format=requirements.txt > requirements.txt
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]"
# push to main branch using CasperWA/push-protected@v2 action
- name: Push to current branch
if: steps.check.outputs.skip != 'true'
uses: CasperWA/push-protected@v2
with:
token: ${{ secrets.GH_TOKEN }}
branch: ${{ github.ref }}
Loading

0 comments on commit ad2c79d

Please sign in to comment.