Skip to content

Commit 7d74afb

Browse files
committed
Merge branch 'development' into feat/DX-7327-variants-branch-support
2 parents 6ef0487 + 7985538 commit 7d74afb

25 files changed

Lines changed: 1092 additions & 262 deletions

File tree

.cursor/rules/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Cursor (optional)
2+
3+
**Cursor** users: start at **[AGENTS.md](../../AGENTS.md)**. All conventions live in **`skills/*/SKILL.md`**.
4+
5+
This folder only points contributors to **`AGENTS.md`** so editor-specific config does not duplicate the canonical docs.

.cursor/rules/dev-workflow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Use this as the standard workflow when contributing to the Android CDA SDK.
55
## Branches
66

77
- Use feature branches for changes (e.g. `feat/...`, `fix/...`).
8-
- Base work off the appropriate long-lived branch (e.g. `staging`, `development`) per team norms.
8+
- Base work off the appropriate long-lived branch (e.g. `development`) per team norms.
99

1010
## Running tests
1111

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Back-merge master to development
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pull-requests: write
12+
13+
jobs:
14+
open-back-merge-pr:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Open back-merge PR if needed
23+
env:
24+
GH_TOKEN: ${{ github.token }}
25+
run: |
26+
set -euo pipefail
27+
BASE_BRANCH="development"
28+
SOURCE_BRANCH="master"
29+
30+
git fetch origin "$BASE_BRANCH" "$SOURCE_BRANCH"
31+
32+
if ! git show-ref --verify --quiet "refs/remotes/origin/$BASE_BRANCH"; then
33+
echo "Base branch '$BASE_BRANCH' does not exist on origin; skipping."
34+
exit 0
35+
fi
36+
37+
SOURCE_SHA=$(git rev-parse "origin/$SOURCE_BRANCH")
38+
BASE_SHA=$(git rev-parse "origin/$BASE_BRANCH")
39+
40+
if [ "$SOURCE_SHA" = "$BASE_SHA" ]; then
41+
echo "$SOURCE_BRANCH and $BASE_BRANCH are at the same commit; nothing to back-merge."
42+
exit 0
43+
fi
44+
45+
EXISTING=$(gh pr list --repo "${{ github.repository }}" --base "$BASE_BRANCH" --head "$SOURCE_BRANCH" --state open --json number --jq 'length')
46+
47+
if [ "$EXISTING" -gt 0 ]; then
48+
echo "An open PR from $SOURCE_BRANCH to $BASE_BRANCH already exists; skipping."
49+
exit 0
50+
fi
51+
52+
gh pr create --repo "${{ github.repository }}" --base "$BASE_BRANCH" --head "$SOURCE_BRANCH" --title "chore: back-merge $SOURCE_BRANCH into $BASE_BRANCH" --body "Automated back-merge after changes landed on \\`$SOURCE_BRANCH\\`. Review and merge to keep \\`$BASE_BRANCH\\` in sync."
53+
54+
echo "Created back-merge PR $SOURCE_BRANCH -> $BASE_BRANCH."

.github/workflows/check-branch.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Check Version Bump
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
version-bump:
8+
name: Version & Changelog bump
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Detect changed files and version bump
17+
id: detect
18+
run: |
19+
if git rev-parse HEAD^2 >/dev/null 2>&1; then
20+
FILES=$(git diff --name-only HEAD^1 HEAD^2)
21+
else
22+
FILES=$(git diff --name-only HEAD~1 HEAD)
23+
fi
24+
VERSION_FILES_CHANGED=false
25+
echo "$FILES" | grep -qx 'package.json' && VERSION_FILES_CHANGED=true
26+
echo "$FILES" | grep -qx 'CHANGELOG.md' && VERSION_FILES_CHANGED=true
27+
echo "version_files_changed=$VERSION_FILES_CHANGED" >> $GITHUB_OUTPUT
28+
# Only lib/, webpack/, dist/, package.json count as release-affecting; .github/ and test/ do not
29+
CODE_CHANGED=false
30+
echo "$FILES" | grep -qE '^lib/|^webpack/|^dist/' && CODE_CHANGED=true
31+
echo "$FILES" | grep -qx 'package.json' && CODE_CHANGED=true
32+
echo "code_changed=$CODE_CHANGED" >> $GITHUB_OUTPUT
33+
34+
- name: Skip when only test/docs/.github changed
35+
if: steps.detect.outputs.code_changed != 'true'
36+
run: |
37+
echo "No release-affecting files changed (e.g. only test/docs/.github). Skipping version-bump check."
38+
exit 0
39+
40+
- name: Fail when version bump was missed
41+
if: steps.detect.outputs.code_changed == 'true' && steps.detect.outputs.version_files_changed != 'true'
42+
run: |
43+
echo "::error::This PR has code changes but no version bump. Please bump the version in package.json and add an entry in CHANGELOG.md."
44+
exit 1
45+
46+
- name: Setup Node
47+
if: steps.detect.outputs.code_changed == 'true' && steps.detect.outputs.version_files_changed == 'true'
48+
uses: actions/setup-node@v4
49+
with:
50+
node-version: '22.x'
51+
52+
- name: Check version bump
53+
if: steps.detect.outputs.code_changed == 'true' && steps.detect.outputs.version_files_changed == 'true'
54+
run: |
55+
set -e
56+
PKG_VERSION=$(node -p "require('./package.json').version.replace(/^v/, '')")
57+
if [ -z "$PKG_VERSION" ]; then
58+
echo "::error::Could not read version from package.json"
59+
exit 1
60+
fi
61+
git fetch --tags --force 2>/dev/null || true
62+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || true)
63+
if [ -z "$LATEST_TAG" ]; then
64+
echo "No existing tags found. Skipping version-bump check (first release)."
65+
exit 0
66+
fi
67+
LATEST_VERSION="${LATEST_TAG#v}"
68+
LATEST_VERSION="${LATEST_VERSION%%-*}"
69+
if [ "$(printf '%s\n' "$LATEST_VERSION" "$PKG_VERSION" | sort -V | tail -1)" != "$PKG_VERSION" ]; then
70+
echo "::error::Version bump required: package.json version ($PKG_VERSION) is not greater than latest tag ($LATEST_TAG). Please bump the version in package.json."
71+
exit 1
72+
fi
73+
if [ "$PKG_VERSION" = "$LATEST_VERSION" ]; then
74+
echo "::error::Version bump required: package.json version ($PKG_VERSION) equals latest tag ($LATEST_TAG). Please bump the version in package.json."
75+
exit 1
76+
fi
77+
CHANGELOG_VERSION=$(sed -nE 's/^## \[v?([0-9]+\.[0-9]+\.[0-9]+).*/\1/p' CHANGELOG.md | head -1)
78+
if [ -z "$CHANGELOG_VERSION" ]; then
79+
echo "::error::Could not find a version entry in CHANGELOG.md (expected line like '## [v1.0.0](...)')."
80+
exit 1
81+
fi
82+
if [ "$CHANGELOG_VERSION" != "$PKG_VERSION" ]; then
83+
echo "::error::CHANGELOG version mismatch: CHANGELOG.md top version ($CHANGELOG_VERSION) does not match package.json version ($PKG_VERSION). Please add or update the CHANGELOG entry for $PKG_VERSION."
84+
exit 1
85+
fi
86+
echo "Version bump check passed: package.json and CHANGELOG.md are at $PKG_VERSION (latest tag: $LATEST_TAG)."

.github/workflows/issues-jira.yml

Lines changed: 104 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,117 @@ name: Create Jira Ticket for Github Issue
22

33
on:
44
issues:
5-
types: [opened]
5+
types: [opened, reopened]
66

77
jobs:
88
issue-jira:
99
runs-on: ubuntu-latest
1010
steps:
11+
- name: Create Jira Issue
12+
id: create_jira
13+
uses: actions/github-script@v9
14+
with:
15+
script: |
16+
const baseUrl = process.env.JIRA_BASE_URL;
17+
const userEmail = process.env.JIRA_USER_EMAIL;
18+
const jiraToken = process.env.JIRA_API_TOKEN;
19+
const jiraProject = process.env.JIRA_PROJECT;
20+
const jiraIssueType = process.env.JIRA_ISSUE_TYPE;
21+
const jiraFields = JSON.parse(process.env.ISSUES_JIRA_FIELDS);
22+
23+
let requestBody = JSON.stringify({
24+
fields: {
25+
...jiraFields,
26+
"project": {
27+
"key": jiraProject
28+
},
29+
"issuetype": {
30+
"name": jiraIssueType
31+
},
32+
"summary": "Github | Issue | ${{ github.event.repository.name }} | ${{ github.event.issue.title }}",
33+
"description": {
34+
"version": 1,
35+
"type": "doc",
36+
"content": [
37+
{
38+
"type": "paragraph",
39+
"content": [
40+
{
41+
"type": "text",
42+
"text": "Github Issue",
43+
"marks": [
44+
{
45+
"type": "strong"
46+
}
47+
]
48+
},
49+
{
50+
"type": "text",
51+
"text": ": "
52+
},
53+
{
54+
"type": "text",
55+
"text": "${{ github.event.issue.html_url }}",
56+
"marks": [
57+
{
58+
"type": "link",
59+
"attrs": {
60+
"href": "${{ github.event.issue.html_url }}"
61+
}
62+
}
63+
]
64+
}
65+
]
66+
},
67+
{
68+
"type": "paragraph",
69+
"content": [
70+
{
71+
"type": "text",
72+
"text": "Description",
73+
"marks": [
74+
{
75+
"type": "strong"
76+
}
77+
]
78+
},
79+
{
80+
"type": "text",
81+
"text": ":"
82+
}
83+
]
84+
},
85+
{
86+
"type": "codeBlock",
87+
"content": [
88+
{
89+
"type": "text",
90+
"text": `${{ github.event.issue.body }}`
91+
}
92+
]
93+
}
94+
]
95+
}
96+
}
97+
});
1198
12-
- name: Login to Jira
13-
uses: atlassian/gajira-login@master
99+
const response = await fetch(`${baseUrl}/rest/api/3/issue`, {
100+
method: 'POST',
101+
headers: {
102+
'Content-Type': 'application/json',
103+
'Authorization': `Basic ${btoa(userEmail + ":" + jiraToken)}`
104+
},
105+
body: requestBody
106+
});
107+
if (!response.ok) {
108+
throw new Error(`JIRA API error! Status: ${response.status}`);
109+
}
110+
const data = await response.json();
111+
console.log('Jira Issue Created:', data.key);
14112
env:
15113
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
16114
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
17115
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
18-
19-
- name: Create Jira Issue
20-
id: create_jira
21-
uses: atlassian/gajira-create@master
22-
with:
23-
project: ${{ secrets.JIRA_PROJECT }}
24-
issuetype: ${{ secrets.JIRA_ISSUE_TYPE }}
25-
summary: Github | Issue | ${{ github.event.repository.name }} | ${{ github.event.issue.title }}
26-
description: |
27-
*GitHub Issue:* ${{ github.event.issue.html_url }}
28-
29-
*Description:*
30-
${{ github.event.issue.body }}
31-
fields: "${{ secrets.ISSUES_JIRA_FIELDS }}"
116+
JIRA_PROJECT: ${{ secrets.JIRA_PROJECT }}
117+
JIRA_ISSUE_TYPE: ${{ secrets.JIRA_ISSUE_TYPE }}
118+
ISSUES_JIRA_FIELDS: "${{ secrets.ISSUES_JIRA_FIELDS }}"

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,6 @@ src/main/res/
4747
contentstack/src/androidTest/java/com/contentstack/sdk/SyncTestCase.java
4848

4949
# key file
50-
key.keystore
50+
key.keystore
51+
52+
contentstack/src/main/resources/assets/regions.json

0 commit comments

Comments
 (0)