Skip to content

Commit

Permalink
Add skip-cache input to Prismic deploy workflow and update webhook ha…
Browse files Browse the repository at this point in the history
…ndler
  • Loading branch information
clari182 committed Jan 27, 2025
1 parent ede48d3 commit 645d35c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
23 changes: 17 additions & 6 deletions .github/workflows/prismic-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ name: Prismic Deploy Trigger
on:
workflow_dispatch:
inputs:
skip-cache:
description: "Skip Cache"
required: true
default: true
type: boolean
environment:
description: "Environment to deploy (e.g., staging or production)"
required: true
Expand All @@ -11,26 +16,32 @@ on:
description: "Commit SHA to deploy"
required: false
netlify-alias:
description: "Netlify alias"
description: "Netlify alias for the deployment"
required: false
cache-modifier:
description: "Cache modifier"
description: "Cache modifier for build"
required: false

repository_dispatch:
types:
- prismic-webhook

jobs:
cache-modifier:
uses: ./.github/workflows/cache-modifier.yml
with:
skip-cache: ${{ github.event.inputs.skip-cache }}

call-deploy:
uses: ./.github/workflows/deploy.yml
needs: [cache-modifier]
secrets: inherit
permissions:
pull-requests: write
with:
environment: ${{ github.event.client_payload.environment || 'staging' }}
sha: ${{ github.event.client_payload.sha || github.sha }}
environment: ${{ github.event.inputs.environment || github.event.client_payload.environment || 'staging' }}
sha: ${{ github.event.inputs.sha || github.event.client_payload.sha || github.sha }}
netlify-context: production
netlify-alias: ${{ github.event.client_payload.netlify_alias || '' }}
netlify-alias: ${{ github.event.inputs.netlify_alias || github.event.client_payload.netlify_alias || '' }}
runner-label: ${{ vars.STAGING_RUNNER_LABEL }}
cache-modifier: ${{ github.event.client_payload.cache_modifier || 'default' }}
cache-modifier: ${{ needs.cache-modifier.outputs.cache-modifier }}
9 changes: 4 additions & 5 deletions site/gatsby-site/netlify/functions/prismicWebhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ exports.handler = async (event) => {
await axios.post(
`https://api.github.com/repos/${GITHUB_OWNER}/${GITHUB_REPO}/actions/workflows/prismic-deploy.yml/dispatches`,
{
event_type: `prismic-deploy`,
client_payload: {
netlify_alias: `prismic-${GITHUB_BRANCH}-deploy`,
cache_modifier: "default",
inputs: {
"netlify-alias": `prismic-${GITHUB_BRANCH}-deploy`,
environment: GITHUB_BRANCH,
"skip-cache": true,
},
ref: "feature/prismic-webhook",
ref: "main",
},
{
headers: {
Expand Down

0 comments on commit 645d35c

Please sign in to comment.