Skip to content

Pinterest Auto-Publisher #4

Pinterest Auto-Publisher

Pinterest Auto-Publisher #4

Workflow file for this run

name: Pinterest Auto-Publisher
on:
schedule:
# Runs at 14:00 UTC (9:00 AM EST) every day
- cron: '0 14 * * *'
# Allow manual trigger from the GitHub Actions UI
workflow_dispatch:
jobs:
publish-pins:
runs-on: ubuntu-latest
permissions:
contents: write # Needed to commit the database back to the repo
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Run Pinterest Bot
env:
PINTEREST_APP_ID: ${{ secrets.PINTEREST_APP_ID }}
PINTEREST_APP_SECRET: ${{ secrets.PINTEREST_APP_SECRET }}
PINTEREST_REFRESH_TOKEN: ${{ secrets.PINTEREST_REFRESH_TOKEN }}
PINTEREST_BOARD_ID: ${{ secrets.PINTEREST_BOARD_ID }}
PINS_PER_DAY: 3
run: node scripts/pinterest-bot.js
- name: Commit Updated Database
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add scripts/pins-data.json
# Only commit if there are changes
git diff --quiet && git diff --staged --quiet || git commit -m "chore: updated pins database after daily upload [skip ci]"
git push