forked from anomalyco/models.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (65 loc) · 2.38 KB
/
test-workflow.yml
File metadata and controls
78 lines (65 loc) · 2.38 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
name: Test Workflow
on:
schedule:
# Run every Monday to Friday at 8:00 AM Pacific Time (4:00 PM UTC)
- cron: '0 16 * * 1,3,5'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
update-models:
name: Update Vercel Models
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: dev
fetch-depth: 0
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install Dependencies
run: bun install
- name: Sync with upstream
run: |
git remote add upstream https://github.com/anomalyco/models.dev.git || true
git fetch upstream
git merge upstream/dev --no-edit
git push origin dev
- name: Generate Vercel models
run: bun run vercel:generate --new-only
- name: Validate models
run: bun run validate
- name: Check for changes
id: check-changes
run: |
if [ -z "$(git status --porcelain providers/vercel/)" ]; then
echo "has-changes=false" >> "$GITHUB_OUTPUT"
echo "No changes detected in Vercel models"
else
echo "has-changes=true" >> "$GITHUB_OUTPUT"
echo "Changes detected in Vercel models"
git status --porcelain providers/vercel/
fi
- name: Send Slack notification
if: always()
run: |
if [ -z "$VERCEL_SLACK_WEBHOOK_URL" ]; then
echo "Slack webhook not configured. Skipping Slack notification."
echo "To enable Slack notifications, add VERCEL_SLACK_WEBHOOK_URL secret to repository settings."
exit 0
fi
curl "$VERCEL_SLACK_WEBHOOK_URL" -X POST -H "Content-Type: application/json" \
-d "{\"channel_id\": \"$CHANNEL_ID\", \"title\": \"Gateway model settings update OUTCOME: ($OUTCOME)\", \"reviewer\": \"$REVIEWER\"}"
env:
VERCEL_SLACK_WEBHOOK_URL: ${{ secrets.VERCEL_SLACK_WEBHOOK_URL }}
HAS_CHANGES: ${{ steps.check-changes.outputs.has-changes }}
PR_CREATED: ${{ steps.check-changes.outcome }}
PR_TITLE: "Update Vercel models (for Models.dev)"
OUTCOME: ${{ steps.check-changes.outcome }}
CHANNEL_ID: "C0A7TF81HS5"
REVIEWER: "U0A54KMV02E"