mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-01-09 14:28:01 -05:00
ci: zip patterns
This commit is contained in:
47
.github/workflows/zip-patterns.yml
vendored
Normal file
47
.github/workflows/zip-patterns.yml
vendored
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user