Merge pull request #1149 from mathisto/patch-1 #18
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: Zip Patterns Folder and Commit | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'patterns/**' | |
permissions: | |
contents: write # Ensure the workflow has write permissions | |
jobs: | |
zip-and-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Git | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Zip patterns folder | |
run: | | |
zip -r patterns.zip patterns | |
- name: Check if zip file has changed | |
id: check_changes | |
run: | | |
git add patterns.zip | |
if git diff --cached --quiet; then | |
echo "No changes to commit." | |
echo "changed=false" >> $GITHUB_ENV | |
else | |
echo "Changes detected." | |
echo "changed=true" >> $GITHUB_ENV | |
- name: Commit and push changes | |
if: env.changed == 'true' | |
run: | | |
git commit -m "Update patterns.zip" | |
git push origin main |