Skip to content

Commit 182a2f3

Browse files
Merge pull request #549 from contentstack/fix/add-back-merge-workflow
Fix/add back merge workflow
2 parents b68b214 + 09cba4d commit 182a2f3

16 files changed

Lines changed: 273 additions & 392 deletions

File tree

.cursor/rules/README.md

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,5 @@
1-
# Cursor Rules Documentation
1+
# Cursor (optional)
22

3-
This directory contains **Cursor AI rules** that provide context-aware guidance for the **Contentstack Management JavaScript SDK** (`@contentstack/management`) — CMA client development, not a separate CLI repo.
3+
**Cursor** users: start at **[`AGENTS.md`](../../AGENTS.md)**. All conventions live in **`skills/*/SKILL.md`**.
44

5-
## Rules overview
6-
7-
| Rule | Role |
8-
|------|------|
9-
| [`dev-workflow.md`](dev-workflow.md) | Branches, lint/tests before PR (unit + optional sanity), version bump guidance, links to skills |
10-
| [`javascript.mdc`](javascript.mdc) | JavaScript / TypeScript declaration style: `lib/`, `webpack/`, `types/`, root `*.mjs` |
11-
| [`contentstack-javascript-cma.mdc`](contentstack-javascript-cma.mdc) | CMA SDK patterns in `lib/`: client, stack, auth, host/region, HTTP/error handling |
12-
| [`testing.mdc`](testing.mdc) | Mocha unit suite, sanity/API tests, Jest + `test/typescript`; env and mocks |
13-
| [`code-review.mdc`](code-review.mdc) | PR checklist: JSDoc, compat, errors, SCA, unit + sanity tests, CMA semantics (**always applied**) |
14-
15-
## Rule application
16-
17-
Rules load from **globs** and **`alwaysApply`** in each file’s frontmatter (not every rule runs for every file).
18-
19-
| Context | Typical rules |
20-
|---------|----------------|
21-
| **Every chat / session** | [`code-review.mdc`](code-review.mdc) (`alwaysApply: true`) |
22-
| **Most project files** | [`dev-workflow.md`](dev-workflow.md)`**/*.js`, `**/*.ts`, `**/*.json`, `**/*.mjs` |
23-
| **SDK implementation** | [`javascript.mdc`](javascript.mdc) + [`contentstack-javascript-cma.mdc`](contentstack-javascript-cma.mdc) for `lib/**/*.js` |
24-
| **Build config** | [`javascript.mdc`](javascript.mdc) for `webpack/**/*.js` |
25-
| **Public types** | [`javascript.mdc`](javascript.mdc) for `types/**` |
26-
| **Tests** | [`testing.mdc`](testing.mdc) for `test/unit/**`, `test/sanity-check/**`, `test/typescript/**`, `test/**/index.js` |
27-
28-
Overlaps are expected (e.g. editing `lib/foo.js` can match `dev-workflow`, `javascript`, and `contentstack-javascript-cma`).
29-
30-
## Usage
31-
32-
- Rules are **loaded automatically** when opened files match their globs (and `code-review` is always in context).
33-
- You can **@ mention** rule files in chat when your Cursor build supports file references, e.g. `@dev-workflow`, `@javascript`, `@contentstack-javascript-cma`, `@testing`, `@code-review` (exact names depend on how Cursor labels `.md` / `.mdc` rules in your project).
34-
35-
## Quick reference table
36-
37-
| File | `alwaysApply` | Globs (summary) |
38-
|------|---------------|-----------------|
39-
| `dev-workflow.md` | no | `**/*.js`, `**/*.ts`, `**/*.json`, `**/*.mjs` |
40-
| `javascript.mdc` | no | `lib/**/*.js`, `webpack/**/*.js`, `types/**/*.ts`, `types/**/*.d.ts`, `*.mjs` |
41-
| `contentstack-javascript-cma.mdc` | no | `lib/**/*.js` |
42-
| `testing.mdc` | no | `test/unit/**`, `test/sanity-check/**`, `test/typescript/**`, `test/**/index.js` |
43-
| `code-review.mdc` | **yes** ||
44-
45-
## Skills & maintenance
46-
47-
- Deeper playbooks: [`skills/README.md`](../../skills/README.md).
48-
- Repo agent entry: [`AGENTS.md`](../../AGENTS.md).
49-
- When directories change, update **globs** in rule frontmatter; keep rules short and put detail in `skills/*/SKILL.md`.
5+
This file is the only artifact under **`.cursor/rules/`** in this repo — no duplicate rules; **`AGENTS.md`** and **`skills/`** are canonical.

.cursor/rules/code-review.mdc

Lines changed: 0 additions & 39 deletions
This file was deleted.

.cursor/rules/contentstack-javascript-cma.mdc

Lines changed: 0 additions & 40 deletions
This file was deleted.

.cursor/rules/dev-workflow.md

Lines changed: 0 additions & 32 deletions
This file was deleted.

.cursor/rules/javascript.mdc

Lines changed: 0 additions & 33 deletions
This file was deleted.

.cursor/rules/testing.mdc

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Opens a PR from master → development after changes land on master (back-merge).
2+
#
3+
# Permissions: default GITHUB_TOKEN needs repo Settings → Actions → General →
4+
# "Workflow permissions" = read and write (to create pull requests). If your org
5+
# restricts this, create a fine-grained PAT with contents:read + pull-requests:write,
6+
# store it as repo secret GH_TOKEN, and set GH_TOKEN on the "Open back-merge PR" step to:
7+
# env:
8+
# GH_TOKEN: ${{ secrets.GH_TOKEN }}
9+
10+
name: Back-merge master to development
11+
12+
on:
13+
push:
14+
branches: [master]
15+
workflow_dispatch:
16+
17+
permissions:
18+
contents: read
19+
pull-requests: write
20+
21+
jobs:
22+
open-back-merge-pr:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Open back-merge PR if needed
31+
env:
32+
GH_TOKEN: ${{ github.token }}
33+
run: |
34+
set -euo pipefail
35+
git fetch origin development master
36+
37+
MASTER_SHA=$(git rev-parse origin/master)
38+
DEV_SHA=$(git rev-parse origin/development)
39+
40+
if [ "$MASTER_SHA" = "$DEV_SHA" ]; then
41+
echo "master and development are at the same commit; nothing to back-merge."
42+
exit 0
43+
fi
44+
45+
EXISTING=$(gh pr list --repo "${{ github.repository }}" \
46+
--base development \
47+
--head master \
48+
--state open \
49+
--json number \
50+
--jq 'length')
51+
52+
if [ "$EXISTING" -gt 0 ]; then
53+
echo "An open PR from master to development already exists; skipping."
54+
exit 0
55+
fi
56+
57+
gh pr create --repo "${{ github.repository }}" \
58+
--base development \
59+
--head master \
60+
--title "chore: back-merge master into development" \
61+
--body "Automated back-merge after changes landed on \`master\`. Review and merge to keep \`development\` in sync."
62+
63+
echo "Created back-merge PR master → development."

.github/workflows/check-branch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Comment PR
11-
if: github.base_ref == 'master' && github.head_ref != 'developement'
11+
if: github.base_ref == 'master' && github.head_ref != 'development'
1212
uses: thollander/actions-comment-pull-request@v2
1313
with:
1414
message: |

0 commit comments

Comments
 (0)