Repository navigation
91 lines (82 loc) · 3.26 KB
/
Copy pathupdate-competitive-matrix.yml
File metadata and controls
91 lines (82 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.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"