Update readme + site screenshots on changed sites.yml #30
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 readme + site screenshots on changed sites.yml | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 1 */3 *' # https://crontab.guru/every-quarter | |
jobs: | |
new-site: | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'janosh' | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Set up node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 19 | |
cache: npm | |
cache-dependency-path: site/package.json | |
- name: Install dependencies | |
run: npm install puppeteer js-yaml imagemin imagemin-webp | |
- name: Update existing site screenshots and repo contributors on scheduled runs | |
if: github.event_name == 'schedule' | |
run: ACTION=update-existing cd site && npm run dev | |
- name: Add screenshots for new sites and update readme | |
if: github.event_name != 'schedule' | |
run: cd site && npm run dev | |
- name: Push changes if any | |
run: | | |
if git diff --quiet site/static/screenshots readme.md; then | |
echo "No changes to commit" | |
exit 0 | |
fi | |
git config user.name 'Janosh Riebesell' | |
git config user.email [email protected] | |
git add readme.md site/static/screenshots | |
git commit -m 'update readme + screenshots' | |
git push |