mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-01-10 06:48:04 -05:00
47 lines
1.1 KiB
YAML
47 lines
1.1 KiB
YAML
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 |