-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c59f9d7
commit 678df79
Showing
3 changed files
with
360 additions
and
1 deletion.
There are no files selected for viewing
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
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 }} | ||
ref: ${{ github.ref }} |
Oops, something went wrong.