Skip to content

CheckForChanges

CheckForChanges #231

name: CheckForChanges
on:
schedule:
- cron: "40 12 * * *"
jobs:
checkForChanges:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: UseNode
uses: actions/setup-node@v4
with:
node-version: "20.x"
- name: ScrapeMarkets
run: |
cd ./scraper
npm install
npm run leipzigde
git diff markets_leipzig_de.json | echo >> git_diff.txt
if [ -s git_diff.txt ]; then echo "HAS_CHANGES=TRUE" >> "$GITHUB_OUTPUT"; fi
- name: UploadWeihnachtsmaerkte
if: ${{ steps.ScrapeMarkets.outputs.HAS_CHANGES }}
uses: actions/upload-artifact@v3
with:
name: weihnachts_maerkte_leipzigde.json
path: markets_leipzig_de.json
retention-days: 1
- name: UploadDiff
if: ${{ steps.ScrapeMarkets.outputs.HAS_CHANGES }}
uses: actions/upload-artifact@v3
with:
name: git_diff.txt
path: git.diff
retention-days: 1
- name: FailOnChanges
if: ${{ steps.ScrapeMarkets.outputs.HAS_CHANGES }}
run: exit 1