Skip to content

Manual build

Manual build #217

Workflow file for this run

name: Manual build
on:
schedule:
- cron: '15 6 * * *'
workflow_dispatch:
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Conditionally deploy
uses: actions/github-script@v7
env:
NETLIFY_BUILD_HOOK_URL: ${{ secrets.NETLIFY_BUILD_HOOK_URL }}
with:
script: |
const CURRENT_DATE = new Date().toISOString().slice(0, 10)
const response = await fetch('https://www.raygesualdo.com/api/publish-dates.json')
const dates = await response.json()
core.startGroup('Data')
core.info(`CURRENT_DATE: ${CURRENT_DATE}`)
core.info(`dates:\n${JSON.stringify(dates, null, 2)}`)
core.endGroup()
if (dates.includes(CURRENT_DATE) && process.env.NETLIFY_BUILD_HOOK_URL) {
console.log(
'A post scheduled for today was found. Triggering a Netlify build.'
)
await fetch(process.env.NETLIFY_BUILD_HOOK_URL, { method: 'POST' })
}