diff --git a/.github/workflows/zip-patterns.yml b/.github/workflows/zip-patterns.yml new file mode 100644 index 000000000..82f5fa042 --- /dev/null +++ b/.github/workflows/zip-patterns.yml @@ -0,0 +1,47 @@ +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 \ No newline at end of file