Update update-mosaic.yml #24
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: Update Mosaic | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: # Enables manual triggering of the workflow | |
jobs: | |
update-mosaic: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 # Updated to v3 | |
with: | |
repository: brunurb/brunurb.github.io | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ssh-strict: true | |
persist-credentials: true | |
clean: true | |
fetch-depth: 1 | |
lfs: false | |
submodules: false | |
set-safe-directory: true | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 # Updated to v3 | |
with: | |
node-version: '18' | |
always-auth: false | |
check-latest: false | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: List files in pictures directory | |
run: ls -la gallery/pictures | |
- name: Run updateMosaic.js | |
run: | | |
cd gallery | |
node updateMosaic.js | |
- name: Commit changes if any | |
run: | | |
cd gallery | |
git config --local user.name "github-actions" | |
git config --local user.email "github-actions@github.com" | |
echo "Current Git Status:" | |
git status | |
git diff --quiet && git diff --staged --quiet || (git commit -am "Update images.js [skip ci]" && git push) | |
- name: Post Process Cleanup | |
if: always() | |
run: echo "Workflow completed." |