Adding algotrade to path. #20
Workflow file for this run
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
name: Lint with Black & Format with isort and Push | |
on: | |
push: | |
branches: | |
- '*' | |
workflow_run: | |
workflows: ["ci-test-run.yml"] | |
types: | |
- completed | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.11 # Python version | |
- name: Install Black | |
run: pip install isort black | |
- name: Run Black and Apply Formatting | |
run: | | |
black `git ls-files '*.py'` | |
isort `git ls-files '*.py'` | |
- name: Show changes | |
run: | | |
git --no-pager diff | |
- name: Show branch | |
run: | | |
git rev-parse --abbrev-ref HEAD | |
- name: Commit and Push Changes if Black made changes | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
if git diff --exit-code; then | |
echo "No changes made by Black, skipping commit and push." | |
else | |
git add . | |
git commit -m "Apply Black formatting" | |
git push origin `git rev-parse --abbrev-ref HEAD` | |
fi |