Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/scripts/create-platform-release-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ create_release_pr() {
create_changelog_pr() {
local platform="$1"
local new_version="$2"
local previous_version="$3"
local previous_release_branch_name="$3"
local release_branch_name="$4"
local changelog_branch_name="$5"

Expand All @@ -313,7 +313,7 @@ create_changelog_pr() {
yarn --cwd install

echo "Generating test plan csv.."
yarn run gen:commits "${platform}" "${previous_version}" "${release_branch_name}" "${PROJECT_GIT_DIR}"
yarn run gen:commits "${platform}" "${previous_release_branch_name}" "${release_branch_name}" "${PROJECT_GIT_DIR}"

if [[ "${TEST_ONLY:-false}" == 'false' ]]; then
echo "Updating release sheet.."
Expand Down Expand Up @@ -420,7 +420,8 @@ main() {
next_version=$(get_next_version "$NEW_VERSION")

# Initialize branch names
local release_branch_name changelog_branch_name version_bump_branch_name
local previous_release_branch_name release_branch_name changelog_branch_name version_bump_branch_name
previous_release_branch_name=$(get_release_branch_name "$PLATFORM" "$PREVIOUS_VERSION")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Incorrect Branch Name Calculation

The previous_release_branch_name is incorrectly calculated using the current TEST_ONLY flag. When get_release_branch_name is called with $PREVIOUS_VERSION, it uses the current TEST_ONLY environment variable to determine the branch prefix (e.g., "release-testing/" vs "release/"). This is problematic because the previous release branch might have been created with a different TEST_ONLY setting. Consequently, the script attempts to find a non-existent branch (e.g., "release-testing/7.7.0" when the actual branch is "release/7.7.0"), causing operations like yarn run gen:commits to fail.

Fix in Cursor Fix in Web

release_branch_name=$(get_release_branch_name "$PLATFORM" "$NEW_VERSION")
changelog_branch_name="chore/${NEW_VERSION}-Changelog"
version_bump_branch_name=$(get_version_bump_branch_name "$next_version") # Execute main workflow
Expand All @@ -433,7 +434,7 @@ main() {
if [ "$TEST_ONLY" == "true" ]; then
echo "Skipping changelog generation in test mode"
else
create_changelog_pr "$PLATFORM" "$NEW_VERSION" "$PREVIOUS_VERSION" "$release_branch_name" "$changelog_branch_name"
create_changelog_pr "$PLATFORM" "$NEW_VERSION" "$previous_release_branch_name" "$release_branch_name" "$changelog_branch_name"
fi

# Step 3: Create version bump PR for main branch
Expand Down
27 changes: 26 additions & 1 deletion .github/scripts/generate-rc-commits.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,31 @@ async function filterCommitsByTeam(platform, branchA, branchB) {
try {
const git = simpleGit();

// Fetch all branches and tags to ensure references exist
await git.fetch(['--all', '--tags', '--prune']);

// Check if branchA exists
let branchAExists = true;
try {
await git.revparse([branchA]);
} catch (e) {
branchAExists = false;
}

// Check if branchB exists
let branchBExists = true;
try {
await git.revparse([branchB]);
} catch (e) {
branchBExists = false;
}

if (!branchAExists || !branchBExists) {
throw new Error(
`Cannot find reference(s):${!branchAExists ? ` ${branchA}` : ''}${!branchBExists ? ` ${branchB}` : ''}.`
);
}

const logOptions = {
from: branchB,
to: branchA,
Expand Down Expand Up @@ -223,7 +248,7 @@ async function main() {
`Generating CSV file for commits between ${branchA} and ${branchB} on ${platform} platform...`,
);

const commitsByTeam = await filterCommitsByTeam(platform, branchA, branchB);
const commitsByTeam = await filterCommitsByTeam(platform, `origin/${branchA}`, `origin/${branchB}`);

if (Object.keys(commitsByTeam).length === 0) {
console.log('No commits found.');
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ on:
required: false
type: string
description: 'The build version for the mobile platform.'
previous-version-tag:
previous-semver-version:
required: true
type: string
description: 'Previous release version tag. eg: v7.7.0'
description: 'A semantic version. eg: x.x.x'
# Flag to indicate if the release is a test release for development purposes only
mobile-template-sheet-id:
required: false
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
echo "Platform: ${{ inputs.platform }}"
echo "Base Branch: ${{ inputs.base-branch }}"
echo "Semver Version: ${{ inputs.semver-version }}"
echo "Previous Version Tag: ${{ inputs.previous-version-tag }}"
echo "Previous Semver Version: ${{ inputs.previous-semver-version }}"
echo "Test Only Mode: ${{ inputs.test-only }}"
if [[ "${{ inputs.platform }}" == "mobile" ]]; then
echo "Mobile Build Version: ${{ inputs.mobile-build-version }}"
Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:
# Execute the script from github-tools
./github-tools/.github/scripts/create-platform-release-pr.sh \
${{ inputs.platform }} \
${{ inputs.previous-version-tag }} \
${{ inputs.previous-semver-version }} \
${{ inputs.semver-version }} \
${{ inputs.mobile-build-version }} \
${{ inputs.git-user-name }} \
Expand Down
Loading