Skip to content

Merge pull request #58 from open-forest-observatory/as_automatic-styl… #2

Merge pull request #58 from open-forest-observatory/as_automatic-styl…

Merge pull request #58 from open-forest-observatory/as_automatic-styl… #2

Workflow file for this run

name: Code Formatter
# Add 'pull_request:' beneath 'on:' to apply on active PRs
on:
push:
branches:
- main
jobs:
isort:
name: Run Isort
runs-on: ubuntu-latest
# Redundant to determine branch name since workflow only runs on main, but will be useful if we also want the workflow to run PRs
steps:
- name: Determine Branch Name
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV
else
BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
fi
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ env.BRANCH_NAME }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Run Isort
run: pip install isort==5.13.2 && isort .
- name: Push changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Apply isort formatting changes
# Ensure Black runs after Isort has completed
black:
needs: isort
uses: ./.github/workflows/black.yml