Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
566da10
content in doc, strapi integration, custom comps supported, isr teste…
manika-signoz Sep 29, 2025
f490b31
remove seo fields, fix build
manika-signoz Sep 29, 2025
ae3013d
nit: remove bg color and tw colour classes
manika-signoz Oct 6, 2025
e35e5d9
import stylesheet
manika-signoz Oct 6, 2025
503c075
handle 404 status code
manika-signoz Oct 8, 2025
21fd98e
Merge branch 'main' into test/cms-with-isr
manika-signoz Oct 15, 2025
a578b08
Merge branch 'main' into test/cms-with-isr
manika-signoz Oct 23, 2025
9aa2fa6
add test data setup
manika-signoz Oct 27, 2025
51b84f3
tag handling for faqs
manika-signoz Oct 28, 2025
c0a528b
setup related_faqs in faqlayout
manika-signoz Oct 28, 2025
1f256b9
add todo
manika-signoz Oct 28, 2025
27dcc18
test
manika-signoz Oct 28, 2025
fa0c6d1
test 2
manika-signoz Oct 29, 2025
ee03a57
test 3
manika-signoz Oct 29, 2025
a2ad76e
test 4
manika-signoz Oct 29, 2025
ef6a470
id -> documentId in updateEntry
manika-signoz Oct 29, 2025
9670fdf
rename revalidation_secret -> revalidate_secret
manika-signoz Oct 29, 2025
bed3413
add more collection schemas
manika-signoz Oct 29, 2025
9664b37
fix relation fields insert
manika-signoz Oct 30, 2025
a37b63e
extract logic to script
manika-signoz Oct 30, 2025
ef4509c
nit: remove unused import
manika-signoz Oct 30, 2025
cfb509a
modified faq - 1 (#2134)
manika-signoz Oct 30, 2025
796fc42
add deployment status as match field to fetchMDX
manika-signoz Oct 31, 2025
708a2c6
init: case-study cms integration
manika-signoz Oct 31, 2025
8909091
pass deployment_type to case-study
manika-signoz Oct 31, 2025
9767d23
remove faq from contentlayer
manika-signoz Oct 31, 2025
aaca655
remove allFAQs from page
manika-signoz Oct 31, 2025
bcb9651
optional chaining to faqs page.tsx
manika-signoz Oct 31, 2025
2fcda09
faqs page and build issues fixed
manika-signoz Oct 31, 2025
d51f3cf
faqs page
manika-signoz Oct 31, 2025
266df51
test: sync case-study
manika-signoz Oct 31, 2025
9c9a037
fix: folder name
manika-signoz Oct 31, 2025
b548873
test sync run
manika-signoz Oct 31, 2025
75891e9
remove invalid key slug
manika-signoz Oct 31, 2025
5e5a429
add desc field
manika-signoz Oct 31, 2025
723b842
add test to case-study to test
manika-signoz Oct 31, 2025
f417e0c
revert test from documents
manika-signoz Oct 31, 2025
d4fb55e
test: sync comparisons
manika-signoz Oct 31, 2025
8b21fb8
remove toc_min_heading_level and toc_max_heading_level, skip document…
manika-signoz Oct 31, 2025
3bb6d1e
resolve 404, try creating if entry not found
manika-signoz Oct 31, 2025
25ba0a5
test comparisons run
manika-signoz Oct 31, 2025
e7851a6
test run
manika-signoz Oct 31, 2025
4657eb2
documentId fix
manika-signoz Oct 31, 2025
edf2b87
add debug logs
manika-signoz Oct 31, 2025
17df847
resolve documentId logic
manika-signoz Oct 31, 2025
84bf554
add debug logs
manika-signoz Oct 31, 2025
0e70dea
test run
manika-signoz Oct 31, 2025
ae39fc3
test run
manika-signoz Oct 31, 2025
0232815
test sync for all comparisons
manika-signoz Oct 31, 2025
3f1445a
fix ssr on resource center -> comparisons
manika-signoz Oct 31, 2025
b210659
fix update PR comment script execution
manika-signoz Oct 31, 2025
ec99f28
improve reporting
manika-signoz Oct 31, 2025
98d58db
use staging in all faqs page for non-prod deployments
manika-signoz Nov 3, 2025
48cf5ff
fix: delete by documentId
manika-signoz Nov 3, 2025
8da4df5
fix: delete flow
manika-signoz Nov 3, 2025
76a5c9b
feat: add sitemap generation logic
manika-signoz Nov 5, 2025
f890f74
add looping logic to handle paginated response in fetchAll
manika-signoz Nov 5, 2025
70c4034
add staging url for staging and base for live
manika-signoz Nov 5, 2025
28bba68
test: add guides handling
manika-signoz Nov 5, 2025
f02dc34
test: add 1 guide
manika-signoz Nov 5, 2025
0dd967a
change workflow branches to pick correct env
manika-signoz Nov 5, 2025
18481c2
add test commit to guides
manika-signoz Nov 5, 2025
7e3e6bb
change staging branch
manika-signoz Nov 5, 2025
dfab0e4
add keywords for guides
manika-signoz Nov 5, 2025
7cb06c7
test: live documents
manika-signoz Nov 5, 2025
dcd53a2
update guides - remove text (#2175)
manika-signoz Nov 5, 2025
af6344c
change prod branch to point to test branch to test merge
manika-signoz Nov 5, 2025
bd3b2ee
Merge branch 'test/cms-with-isr' of github.com:SigNoz/signoz-web into…
manika-signoz Nov 5, 2025
68449ce
remove slug from all guides to enable sync (#2176)
manika-signoz Nov 7, 2025
3caca81
add for testing (#2183)
manika-signoz Nov 7, 2025
bfca818
add rss revalidation
manika-signoz Nov 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
231 changes: 231 additions & 0 deletions .github/workflows/sync-content-cms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
# GitHub Actions Workflow: Sync Content to Strapi CMS (With Relations Support)
# This workflow syncs content changes from specific data folders to Strapi CMS
# Supports foreign key relations: tags, authors, related_faqs
# Triggers: On labeled PR, on push to staging/main branches

name: Sync Content to Strapi CMS

on:
pull_request:
types: [labeled, synchronize, opened, reopened]
paths:
- 'data/**/*.mdx'
- 'data/**/*.md'
push:
branches:
- test/cms-with-isr # Configurable: Change to your production branch
- staging # Configurable: Change to your staging branch
paths:
- 'data/**/*.mdx'
- 'data/**/*.md'

env:
# Configurable: Array of folders to sync to CMS
SYNC_FOLDERS: '["faqs", "case-study", "comparisons", "guides"]'

# Strapi Configuration
CMS_API_URL: ${{ secrets.CMS_API_URL }}
CMS_API_TOKEN: ${{ secrets.CMS_API_TOKEN }}

# Revalidation Configuration
NEXT_PUBLIC_BASE_URL: ${{ secrets.NEXT_PUBLIC_BASE_URL }}
NEXT_PUBLIC_STAGING_BASE_URL: ${{ secrets.NEXT_PUBLIC_STAGING_BASE_URL }}
REVALIDATE_SECRET: ${{ secrets.REVALIDATE_SECRET }}

# Branch Configuration
PRODUCTION_BRANCH: 'test/cms-with-isr'
STAGING_BRANCH: 'test/cms-with-isr'

jobs:
detect-changes:
name: Detect Changed Files
runs-on: ubuntu-latest
outputs:
changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
deleted_files: ${{ steps.changed-files.outputs.deleted_files }}
any_changed: ${{ steps.changed-files.outputs.any_changed }}
any_deleted: ${{ steps.changed-files.outputs.any_deleted }}
deployment_status: ${{ steps.determine-status.outputs.deployment_status }}
should_sync: ${{ steps.check-sync.outputs.should_sync }}

steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get Changed Files
id: changed-files
uses: tj-actions/changed-files@v44
with:
files: |
data/**/*.mdx
data/**/*.md
json: true
escape_json: false

- name: Check if Sync is Required
id: check-sync
run: |
echo "Checking if sync should run..."

if [[ "${{ github.event_name }}" == "pull_request" ]]; then
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'staging') }}" == "true" ]]; then
echo "should_sync=true" >> $GITHUB_OUTPUT
echo "✅ Sync enabled: PR has 'staging' label"
else
echo "should_sync=false" >> $GITHUB_OUTPUT
echo "⏭️ Sync skipped: PR does not have 'staging' label"
fi
else
echo "should_sync=true" >> $GITHUB_OUTPUT
echo "✅ Sync enabled: Push event to branch"
fi

- name: Determine Deployment Status
id: determine-status
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'staging') }}" == "true" ]]; then
echo "deployment_status=staging" >> $GITHUB_OUTPUT
echo "📦 Deployment Status: staging"
else
echo "deployment_status=draft" >> $GITHUB_OUTPUT
echo "📦 Deployment Status: draft"
fi
elif [[ "${{ github.ref }}" == "refs/heads/${{ env.PRODUCTION_BRANCH }}" ]]; then
echo "deployment_status=live" >> $GITHUB_OUTPUT
echo "📦 Deployment Status: live"
elif [[ "${{ github.ref }}" == "refs/heads/${{ env.STAGING_BRANCH }}" ]]; then
echo "deployment_status=staging" >> $GITHUB_OUTPUT
echo "📦 Deployment Status: staging"
else
echo "deployment_status=draft" >> $GITHUB_OUTPUT
echo "📦 Deployment Status: draft"
fi

- name: Display Changed Files
if: steps.changed-files.outputs.any_changed == 'true'
run: |
echo "📝 Changed files detected:"
echo '${{ steps.changed-files.outputs.all_changed_files }}' | jq -r '.[]'

- name: Display Deleted Files
if: steps.changed-files.outputs.any_deleted == 'true'
run: |
echo "🗑️ Deleted files detected:"
echo '${{ steps.changed-files.outputs.deleted_files }}' | jq -r '.[]'

sync-to-cms:
name: Sync Content to CMS
runs-on: ubuntu-latest
needs: detect-changes
if: (needs.detect-changes.outputs.any_changed == 'true' || needs.detect-changes.outputs.any_deleted == 'true') && needs.detect-changes.outputs.should_sync == 'true'

steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install Dependencies
run: |
npm install --no-save \
gray-matter \
axios \
js-yaml

- name: Sync Content to Strapi
id: sync
env:
CHANGED_FILES: ${{ needs.detect-changes.outputs.changed_files }}
DELETED_FILES: ${{ needs.detect-changes.outputs.deleted_files }}
DEPLOYMENT_STATUS: ${{ needs.detect-changes.outputs.deployment_status }}
run: node scripts/sync-content-to-strapi.js

- name: Trigger Revalidation
if: success()
env:
DEPLOYMENT_STATUS: ${{ needs.detect-changes.outputs.deployment_status }}
run: |
echo "🔄 Triggering ISR revalidation..."
echo "Environment: $DEPLOYMENT_STATUS"

# Determine the base URL based on deployment status
if [ "$DEPLOYMENT_STATUS" = "live" ]; then
BASE_URL="${{ env.NEXT_PUBLIC_BASE_URL }}"
echo "Using production URL: $BASE_URL"
elif [ "$DEPLOYMENT_STATUS" = "staging" ]; then
BASE_URL="${{ env.NEXT_PUBLIC_STAGING_BASE_URL }}"
echo "Using staging URL: $BASE_URL"
else
echo "⏭️ Skipping revalidation for draft deployment"
exit 0
fi

RESPONSE=$(curl -s -w "\n%{http_code}" --location "$BASE_URL/api/revalidate" \
--header 'Content-Type: application/json' \
--data "{
\"revalidateAll\": true,
\"clearCache\": true,
\"secret\": \"${{ env.REVALIDATE_SECRET }}\"
}")

HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
BODY=$(echo "$RESPONSE" | head -n-1)

if [ "$HTTP_CODE" -eq 200 ]; then
echo "✅ Revalidation successful!"
echo "Response: $BODY"
else
echo "❌ Revalidation failed with HTTP $HTTP_CODE"
echo "Response: $BODY"
exit 1
fi

- name: Update PR Comment
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
env:
JOB_STATUS: ${{ job.status }}
DEPLOYMENT_STATUS: ${{ needs.detect-changes.outputs.deployment_status }}
with:
script: |
const script = require('${{ github.workspace }}/scripts/update-pr-comment.js');
await script({github, context, core});

report-status:
name: Report Status
runs-on: ubuntu-latest
needs: [detect-changes, sync-to-cms]
if: always()

steps:
- name: Report Success
if: needs.sync-to-cms.result == 'success'
run: |
echo "✅ Workflow completed successfully!"
echo "Deployment Status: ${{ needs.detect-changes.outputs.deployment_status }}"

- name: Report Failure
if: needs.sync-to-cms.result == 'failure'
run: |
echo "❌ Workflow failed!"
echo "Please check the logs above for detailed error messages."
exit 1

- name: Report Skipped
if: needs.detect-changes.outputs.should_sync != 'true' || (needs.detect-changes.outputs.any_changed != 'true' && needs.detect-changes.outputs.any_deleted != 'true')
run: |
echo "⏭️ Sync was skipped."
if [[ "${{ needs.detect-changes.outputs.any_changed }}" != "true" && "${{ needs.detect-changes.outputs.any_deleted }}" != "true" ]]; then
echo "Reason: No content files changed or deleted"
else
echo "Reason: PR does not have 'staging' label"
fi
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ app/tag-data.json
# Interlinking data files (large, not for VCS)
interlinking.csv.bak
scripts/data/interlinking.csv

# Sync results (temporary file for CI/CD)
sync-results.json
Loading