sort script still not running #253
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: Sort CSV Files | |
on: | |
push: | |
paths: | |
- 'source/**' | |
- 'tools/sort_lists.py' | |
jobs: | |
sort-files: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Check for changes in source folder | |
id: changed_files | |
run: | | |
if [ $(git rev-list --count HEAD) -gt 1 ]; then | |
changed_files=$(git diff --name-only HEAD~1 HEAD | grep -E '^source/.*\.csv$') | |
else | |
changed_files=$(git ls-files | grep -E '^source/.*\.csv$') | |
fi | |
sanitized_changed_files=$(echo "$changed_files" | tr '\n' ' ') | |
echo "changed_files=$sanitized_changed_files" >> $GITHUB_ENV | |
- name: Sort CSV files | |
if: env.changed_files | |
run: | | |
python tools/sort_lists.py | |
- name: Commit changes | |
if: env.changed_files | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add source/ | |
git commit -m "Sort CSV files" -a | |
git push |