Skip to content

Commit 73aec42

Browse files
committed
Merge branch 'refactor-build' into develop
# Conflicts: # .github/workflows/s3-deploy-development.yml # .github/workflows/s3-deploy-production.yml # src/content/docs/version-3.0/predicted-ltv-and-revenue.mdx # src/locales/ru/_sidebar-labels.json # src/locales/ru/analytics-cohorts.mdx # src/locales/ru/autopilot.mdx # src/locales/ru/predicted-ltv-and-revenue.mdx # src/locales/ru/sdk-installation-flutter.mdx # src/locales/ru/ua-analytics.mdx # src/locales/ru/ua-facebook.mdx # src/locales/ru/ua-tiktok.mdx # src/locales/ru/user-acquisition.mdx
2 parents 493b60e + e8551f1 commit 73aec42

57 files changed

Lines changed: 1362 additions & 676 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
name: sync-branch-to-develop
3+
description: Use when finishing work on a feature branch and wanting to promote it to develop (or another integration branch) while staying on the original branch. Handles commit, push, merge, push develop, and return.
4+
---
5+
6+
# Sync branch to develop
7+
8+
## Overview
9+
10+
Promote the current branch to the `develop` integration branch and return, so the user keeps working where they were. The sequence: commit any pending work, push the current branch, fast-forward-update develop, merge the branch into develop, push develop, check out the original branch.
11+
12+
Users end where they started. Never leave them on `develop`.
13+
14+
## When to use
15+
16+
- User says: "sync to develop", "push and merge to develop", "promote this branch to staging", "land this on develop", or equivalent.
17+
- A feature branch is ready to land on the integration branch while work continues.
18+
19+
## When NOT to use
20+
21+
- Current branch IS `develop`, `main`, or another protected trunk → refuse, explain why.
22+
- Target is not `develop` → confirm the target branch name with the user before proceeding.
23+
- User wants to merge via PR, not directly → skip this skill and open a PR instead.
24+
25+
## Workflow
26+
27+
**Before step 1:** capture the starting branch with `git rev-parse --abbrev-ref HEAD`. You return here at the end no matter what — including on failure.
28+
29+
### 1. Commit pending work (skip if clean)
30+
31+
- Run `git status --porcelain`. Empty → skip this step.
32+
- Read all pending changes: `git status` + `git diff` (staged + unstaged).
33+
- Look at recent commit history to match the repo's style: `git log --oneline -10`.
34+
- Draft the commit message following the rules in "Writing the commit message" below.
35+
- Show the user the diff summary **and** the drafted message. Commit only after they approve (or implicitly approve by telling you to proceed).
36+
- Stage specific files by name. Never `git add -A` or `git add .` (risks staging secrets, unrelated files).
37+
- Refuse to stage files that likely contain secrets (`.env`, `credentials.json`, private keys). Warn and skip.
38+
- Use a HEREDOC to pass the commit message so multi-line formatting is preserved (see example below).
39+
- If a pre-commit hook fails: surface the error, fix the underlying issue, re-stage, and create a **new** commit. Never `--amend` (the failed commit didn't happen), never `--no-verify`.
40+
41+
#### Writing the commit message
42+
43+
Match the repo's existing style (check `git log --oneline -10` first). General rules:
44+
45+
- **Subject line:** one line, imperative mood, ≤70 characters, no trailing period. Match the pattern of recent commits.
46+
- **Body (optional, only if helpful):** 1–2 sentences explaining *why* the change was made, not what it does. Wrap at ~72 chars.
47+
- **Verb choice reflects nature:** "Add" for wholly new features, "Update" for enhancements, "Fix" for bugs, "Refactor" for internal restructuring, "Remove" for deletions, "Docs" for documentation-only changes.
48+
- **No filler:** don't reference the task/PR number unless the repo convention does it; don't narrate ("this commit…"); don't list every file.
49+
- **No Co-Authored-By trailer** — the commit content may not have been authored by Claude; only add it if the user explicitly asks.
50+
51+
Commit via HEREDOC (preserves formatting):
52+
53+
```bash
54+
git commit -m "$(cat <<'EOF'
55+
Subject line here
56+
57+
Optional short body explaining why.
58+
EOF
59+
)"
60+
```
61+
62+
### 2. Push the current branch
63+
64+
- First push: `git push -u origin <branch>`
65+
- Otherwise: `git push`
66+
- If push is rejected (non-fast-forward, protected branch, etc.) — stop and report. Never force-push without an explicit ask.
67+
68+
### 3. Update develop locally
69+
70+
- `git fetch origin`
71+
- `git checkout develop`
72+
- `git pull --ff-only origin develop`
73+
- If the fast-forward fails (local develop has diverged), stop and ask the user how to proceed. Do not `reset --hard` or force-pull.
74+
75+
### 4. Merge the branch into develop
76+
77+
- `git merge --no-ff <branch>``--no-ff` keeps the feature branch identifiable in history. Only omit if the user prefers fast-forward merges.
78+
- On conflict: stop, list conflicted files, ask the user. Never use `-X ours/theirs`, `--strategy=ours`, or force-resolve silently.
79+
80+
### 5. Push develop
81+
82+
- `git push origin develop`
83+
- On rejection (protected branch, diverged remote), stop and report. Never force-push develop.
84+
85+
### 6. Return to the original branch
86+
87+
- `git checkout <original-branch>`
88+
- Run `git status` to confirm state. Report to user: what landed on develop, which commit SHA, remote status.
89+
90+
## Quick reference
91+
92+
| Step | Command | Skip when |
93+
|------|---------|-----------|
94+
| Commit | `git add <files> && git commit -m "msg"` | Working tree clean |
95+
| Push branch | `git push [-u origin <branch>]` | Never |
96+
| Fetch | `git fetch origin` | Never |
97+
| Update develop | `git checkout develop && git pull --ff-only origin develop` | Never |
98+
| Merge | `git merge --no-ff <branch>` | Never |
99+
| Push develop | `git push origin develop` | Never |
100+
| Return | `git checkout <original-branch>` | Never |
101+
102+
## Common mistakes
103+
104+
- **Committing without review.** Always show the diff summary and the drafted message first, then wait for approval.
105+
- **`git add -A` / `git add .`** — stage specific files by name.
106+
- **Vague commit messages** ("updates", "fixes things") — check `git log` for the repo's voice and write a message that says *what* changed at a conceptual level and *why*.
107+
- **Adding a Co-Authored-By trailer by default** — the commit contents may not have been written by Claude. Omit unless the user asks for it.
108+
- **Bypassing hook failures with `--no-verify`** — fix the underlying issue instead.
109+
- **`git commit --amend` after a hook failure** — the failed commit didn't happen; amend would modify the previous real commit. Create a new commit instead.
110+
- **`git reset --hard` or force-pull on develop divergence** — stop and ask.
111+
- **Silent conflict resolution** — surface conflicts, don't auto-pick sides.
112+
- **Force-pushing develop or origin branch** — never, without explicit user instruction.
113+
- **Forgetting to return** — the final `checkout <original-branch>` is mandatory.
114+
- **Running on main** — refuse. `main → develop` is not this workflow.
115+
116+
## Red flags — STOP and ask
117+
118+
- User rejects the drafted commit message → re-draft or ask for theirs; do not commit
119+
- Pre-commit / pre-push hook failure
120+
- `git pull --ff-only origin develop` fails (diverged)
121+
- Merge conflict
122+
- Push rejected (any branch)
123+
- Current branch is `develop`, `main`, or another trunk
124+
- Staged diff includes a file that looks like it holds secrets (`.env*`, `*.pem`, `credentials*`)
125+
126+
On any red flag: stop the workflow, report state, checkout back to the starting branch if you left it, ask the user.

.github/workflows/s3-deploy-development.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,16 @@ on:
66
jobs:
77
build-en:
88
runs-on: ubuntu-latest
9+
concurrency:
10+
group: build-en-${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
912
steps:
1013
- uses: actions/checkout@v4
1114

1215
- uses: actions/setup-node@v4
1316
with:
1417
node-version: 20
15-
16-
- name: Cache node_modules
17-
uses: actions/cache@v4
18-
with:
19-
path: node_modules
20-
key: npm-${{ hashFiles('package-lock.json') }}
18+
cache: 'npm'
2119

2220
- name: Cache Astro build
2321
uses: actions/cache@v4
@@ -26,7 +24,7 @@ jobs:
2624
key: astro-dev-en-${{ github.sha }}
2725
restore-keys: astro-dev-en-
2826

29-
- run: npm ci
27+
- run: npm ci --omit=optional
3028

3129
- name: Build English only
3230
env:
@@ -49,18 +47,16 @@ jobs:
4947
strategy:
5048
matrix:
5149
locale: [zh, tr, ru]
50+
concurrency:
51+
group: build-locale-${{ matrix.locale }}-${{ github.workflow }}-${{ github.ref }}
52+
cancel-in-progress: true
5253
steps:
5354
- uses: actions/checkout@v4
5455

5556
- uses: actions/setup-node@v4
5657
with:
5758
node-version: 20
58-
59-
- name: Cache node_modules
60-
uses: actions/cache@v4
61-
with:
62-
path: node_modules
63-
key: npm-${{ hashFiles('package-lock.json') }}
59+
cache: 'npm'
6460

6561
- name: Cache Astro build
6662
uses: actions/cache@v4
@@ -69,7 +65,7 @@ jobs:
6965
key: astro-dev-${{ matrix.locale }}-${{ github.sha }}
7066
restore-keys: astro-dev-${{ matrix.locale }}-
7167

72-
- run: npm ci
68+
- run: npm ci --omit=optional
7369

7470
- name: Build locale ${{ matrix.locale }}
7571
env:
@@ -85,6 +81,9 @@ jobs:
8581
deploy:
8682
needs: [build-en, build-locale]
8783
runs-on: ubuntu-latest
84+
concurrency:
85+
group: deploy-${{ github.workflow }}-${{ github.ref }}
86+
cancel-in-progress: false
8887
permissions:
8988
contents: write
9089
environment: development

.github/workflows/s3-deploy-production.yml

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,17 @@ jobs:
4141
needs: classify
4242
if: needs.classify.outputs.translation_only == 'false'
4343
runs-on: ubuntu-latest
44+
concurrency:
45+
group: check-internal-links-${{ github.workflow }}-${{ github.ref }}
46+
cancel-in-progress: true
4447
steps:
4548
- uses: actions/checkout@v4
4649
with:
4750
fetch-depth: 0
4851
- uses: actions/setup-node@v4
4952
with:
5053
node-version: 20
54+
cache: 'npm'
5155
- run: npm install github-slugger
5256
- run: node scripts/check-links/index.mjs --diff --base=last-production-deploy --internal-only
5357

@@ -57,18 +61,16 @@ jobs:
5761
build-en:
5862
needs: check-internal-links
5963
runs-on: ubuntu-latest
64+
concurrency:
65+
group: build-en-${{ github.workflow }}-${{ github.ref }}
66+
cancel-in-progress: true
6067
steps:
6168
- uses: actions/checkout@v4
6269

6370
- uses: actions/setup-node@v4
6471
with:
6572
node-version: 20
66-
67-
- name: Cache node_modules
68-
uses: actions/cache@v4
69-
with:
70-
path: node_modules
71-
key: npm-${{ hashFiles('package-lock.json') }}
73+
cache: 'npm'
7274

7375
- name: Cache Astro build
7476
uses: actions/cache@v4
@@ -77,7 +79,7 @@ jobs:
7779
key: astro-en-${{ github.sha }}
7880
restore-keys: astro-en-
7981

80-
- run: npm ci
82+
- run: npm ci --omit=optional
8183

8284
- name: Build English only
8385
env:
@@ -101,18 +103,16 @@ jobs:
101103
strategy:
102104
matrix:
103105
locale: [zh, tr, ru]
106+
concurrency:
107+
group: build-locale-full-${{ matrix.locale }}-${{ github.workflow }}-${{ github.ref }}
108+
cancel-in-progress: true
104109
steps:
105110
- uses: actions/checkout@v4
106111

107112
- uses: actions/setup-node@v4
108113
with:
109114
node-version: 20
110-
111-
- name: Cache node_modules
112-
uses: actions/cache@v4
113-
with:
114-
path: node_modules
115-
key: npm-${{ hashFiles('package-lock.json') }}
115+
cache: 'npm'
116116

117117
- name: Cache Astro build
118118
uses: actions/cache@v4
@@ -121,7 +121,7 @@ jobs:
121121
key: astro-${{ matrix.locale }}-${{ github.sha }}
122122
restore-keys: astro-${{ matrix.locale }}-
123123

124-
- run: npm ci
124+
- run: npm ci --omit=optional
125125

126126
- name: Build locale ${{ matrix.locale }}
127127
env:
@@ -137,6 +137,9 @@ jobs:
137137
deploy-full:
138138
needs: [build-en, build-locale-full]
139139
runs-on: ubuntu-latest
140+
concurrency:
141+
group: deploy-full-${{ github.workflow }}-${{ github.ref }}
142+
cancel-in-progress: false
140143
permissions:
141144
contents: write
142145
environment: production
@@ -192,18 +195,16 @@ jobs:
192195
strategy:
193196
matrix:
194197
locale: [zh, tr, ru]
198+
concurrency:
199+
group: build-locale-only-${{ matrix.locale }}-${{ github.workflow }}-${{ github.ref }}
200+
cancel-in-progress: true
195201
steps:
196202
- uses: actions/checkout@v4
197203

198204
- uses: actions/setup-node@v4
199205
with:
200206
node-version: 20
201-
202-
- name: Cache node_modules
203-
uses: actions/cache@v4
204-
with:
205-
path: node_modules
206-
key: npm-${{ hashFiles('package-lock.json') }}
207+
cache: 'npm'
207208

208209
- name: Cache Astro build
209210
uses: actions/cache@v4
@@ -212,7 +213,7 @@ jobs:
212213
key: astro-${{ matrix.locale }}-${{ github.sha }}
213214
restore-keys: astro-${{ matrix.locale }}-
214215

215-
- run: npm ci
216+
- run: npm ci --omit=optional
216217

217218
- name: Build locale ${{ matrix.locale }}
218219
env:
@@ -228,6 +229,9 @@ jobs:
228229
deploy-translations:
229230
needs: build-locale-only
230231
runs-on: ubuntu-latest
232+
concurrency:
233+
group: deploy-translations-${{ github.workflow }}-${{ github.ref }}
234+
cancel-in-progress: false
231235
permissions:
232236
contents: write
233237
environment: production

.github/workflows/translate.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,16 @@ on:
1010
- 'src/api-reference/specs/*.yaml'
1111
- 'src/locales/dictionary.json'
1212

13+
# Queue concurrent runs (do not cancel) so an in-flight Anthropic batch isn't
14+
# killed mid-call and two pushes don't race on the translation commit.
15+
concurrency:
16+
group: translate-${{ github.ref }}
17+
cancel-in-progress: false
18+
1319
jobs:
1420
translate:
1521
runs-on: ubuntu-latest
22+
timeout-minutes: 60
1623
permissions:
1724
contents: write
1825

@@ -39,7 +46,7 @@ jobs:
3946
cache: 'npm'
4047

4148
- name: Install dependencies
42-
run: npm ci
49+
run: npm ci --omit=optional
4350

4451
# Split the diff into added/modified files (to translate) and deleted files (to clean up).
4552
- name: Get changed translatable files

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "module",
44
"version": "0.0.1",
55
"scripts": {
6-
"dev": "npm run prebuild && npm run build:md && astro dev",
6+
"dev": "npm run prebuild && npm run build:md && NODE_OPTIONS='--max-old-space-size=8192' BUILD_LOCALES=none astro dev",
77
"prebuild": "mkdir -p public/api-specs && rm -rf public/FF_img public/img_webhook_flows public/img && [ -d src/assets/shared/img ] && cp -r src/assets/shared/img public/ || true && [ -d src/assets/shared/FF_img ] && cp -r src/assets/shared/FF_img public/ || true && [ -d src/content/docs/version-3.0/img_webhook_flows ] && cp -r src/content/docs/version-3.0/img_webhook_flows public/ || true && [ -d src/api-reference/specs ] && cp -r src/api-reference/specs/* public/api-specs/ || true",
88
"build": "astro build && npm run build:md:prod",
99
"build:md": "node scripts/generate-md.mjs && node scripts/generate-llms.mjs && node scripts/generate-platform-llms-full.mjs",
@@ -52,9 +52,11 @@
5252
"eslint": "^10.1.0",
5353
"eslint-plugin-astro": "^1.6.0",
5454
"globals": "^17.4.0",
55-
"puppeteer": "^24.0.0",
5655
"typescript": "^5.9.3",
5756
"typescript-eslint": "^8.57.2"
5857
},
58+
"optionalDependencies": {
59+
"puppeteer": "^24.0.0"
60+
},
5961
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
6062
}
53.6 KB
Loading
-5.81 KB
Loading
11.1 KB
Loading
261 KB
Loading
62 KB
Loading

0 commit comments

Comments
 (0)