Skip to content

Commit

Permalink
fix #10 - generate GIF only if src changed
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtysn committed Aug 22, 2024
1 parent d4c4251 commit 523cdf4
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 4 deletions.
29 changes: 27 additions & 2 deletions .github/workflows/generate-gif-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Check for changes in src folder
id: check_changes
run: |
if git diff --quiet HEAD^ HEAD -- src/; then
echo "No changes in the src folder."
echo "::set-output name=changed::false"
else
echo "Changes detected in the src folder."
echo "::set-output name=changed::true"
fi
- name: Generate GIF from Website
if: steps.check_changes.outputs.changed == 'true'
uses: PabloLec/website-to-gif@2.1.1
with:
url: "https://mrtysn.github.io/cv/"
Expand All @@ -22,10 +35,22 @@ jobs:
scroll_step: 15
time_per_frame: 100
start_delay: 4000

- name: Commit GIF to the Repository
if: steps.check_changes.outputs.changed == 'true'
id: commit
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git add .
git commit -m 'Automatically generate GIF of the CV website'
git push
if git diff-index --quiet HEAD; then
echo "No changes to commit."
echo "::set-output name=changed_commit::false"
else
git commit -m 'Automatically generate GIF of the CV website'
echo "::set-output name=changed_commit::true"
fi
- name: Push changes
if: steps.commit.outputs.changed_commit == 'true'
run: git push
29 changes: 27 additions & 2 deletions .github/workflows/generate-gif.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Check for changes in src folder
id: check_changes
run: |
if git diff --quiet HEAD^ HEAD -- src/; then
echo "No changes in the src folder."
echo "::set-output name=changed::false"
else
echo "Changes detected in the src folder."
echo "::set-output name=changed::true"
fi
- name: Generate GIF from Website
if: steps.check_changes.outputs.changed == 'true'
uses: PabloLec/website-to-gif@2.1.1
with:
url: "https://mrtysn.github.io/cv/"
Expand All @@ -24,10 +37,22 @@ jobs:
scroll_step: 15
time_per_frame: 100
start_delay: 4000

- name: Commit GIF to the Repository
if: steps.check_changes.outputs.changed == 'true'
id: commit
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git add .
git commit -m 'Automatically generate GIF of the CV website'
git push
if git diff-index --quiet HEAD; then
echo "No changes to commit."
echo "::set-output name=changed_commit::false"
else
git commit -m 'Automatically generate GIF of the CV website'
echo "::set-output name=changed_commit::true"
fi
- name: Push changes
if: steps.commit.outputs.changed_commit == 'true'
run: git push

0 comments on commit 523cdf4

Please sign in to comment.