Skip to content

Update Competitive Matrix #21

Update Competitive Matrix

Update Competitive Matrix #21

name: Update Competitive Matrix
on:
schedule:
- cron: "0 9 * * 1" # Weekly Monday 9am UTC
workflow_dispatch:
concurrency:
group: competitive-matrix
cancel-in-progress: true
permissions:
contents: read
jobs:
update-matrix:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Update competitive matrix
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx tsx scripts/update-competitive-matrix.ts --summary /tmp/matrix-summary.md
- name: Check for changes
id: changes
run: |
if git diff --quiet docs/; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Configure git credentials
if: steps.changes.outputs.changed == 'true'
run: |
git config --local --unset-all http.https://github.com/.extraheader || true
git config --local url."https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/"
- name: Create PR
if: steps.changes.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
BRANCH="auto/competitive-matrix-$(date +%Y%m%d)"
git checkout -b "$BRANCH"
git add docs/
git commit -m "docs: update competitive matrix and migration pages from latest competitor data"
git push -u origin "$BRANCH"
gh pr create \
--title "Update competitive matrix and migration pages" \
--body-file /tmp/matrix-summary.md \
--base main
- name: Notify Slack
if: always()
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
CHANGED: ${{ steps.changes.outputs.changed }}
JOB_STATUS: ${{ job.status }}
RUN_ID: ${{ github.run_id }}
run: |
if [ -z "$SLACK_WEBHOOK" ]; then echo "SLACK_WEBHOOK not set, skipping"; exit 0; fi
if [ "$CHANGED" = "true" ]; then
EMOJI="📊"
MSG="*Competitive matrix changes detected* — PR created with updated migration pages. <https://github.com/CopilotKit/aimock/actions/runs/${RUN_ID}|View run>"
elif [ "$JOB_STATUS" = "success" ]; then
EMOJI="✅"
MSG="Competitive matrix check — no changes detected."
else
EMOJI="❌"
MSG="*Competitive matrix update failed*. <https://github.com/CopilotKit/aimock/actions/runs/${RUN_ID}|View run>"
fi
PAYLOAD=$(jq -n --arg text "${EMOJI} ${MSG}" '{text: $text}')
curl -s -X POST "$SLACK_WEBHOOK" \
-H "Content-Type: application/json" \
-d "$PAYLOAD"