Glendale, Wisconsin #6
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: Process Image on Commit | |
on: | |
push: | |
paths: | |
- "photos/**" # Specify that all changes within the 'photos' folder and its subfolders trigger the action | |
jobs: | |
process_image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pillow exifread | |
- name: Process Images | |
run: | | |
for file in $(git diff --name-only --diff-filter=A HEAD^ HEAD | grep -E '^photos/.*\.(jpg|jpeg|png)$'); do | |
python process_image.py "$file" | |
done | |
- name: List changed files | |
run: git status | |
- name: Commit changes | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
git add photos/*.json photos/*_thumbnail.* | |
git commit -m "Generated thumbnail and EXIF data" || echo "No changes to commit" | |
git push || echo "Nothing to push" |