Skip to content

Conversation

@jluque0101
Copy link
Contributor

@jluque0101 jluque0101 commented Dec 19, 2025

  • What is the current state of things and why does it need to change?

  • What is the solution your changes offer and how does it work?

    • Extract shared helper functions into a centralized utils.sh
    • Delegate changelog management from create-platform-release-pr.sh to update-release-changelog.sh
    • Fix bugs in hotfix detection, branch creation, and PR existence checks
    • Improve script documentation and parameter consistency
    • No changes required on consumer repositories

Are there any issues or other links reviewers should consult to understand this pull request better? For instance:

See:


Note

Consolidates release automation by extracting shared helpers and moving changelog logic to a standalone script.

  • Adds utils.sh with shared configure_git, checkout_or_create_branch, push_branch_with_handling, and create_pr_if_not_exists used across scripts
  • Introduces update-release-changelog.sh to generate/update changelog branches and draft PRs (syncs release branch, chooses existing release/<version>-Changelog or chore/<version>-Changelog, commits/pushes, creates PR); removes commits.csv generation from this flow
  • Refactors create-platform-release-pr.sh to source utils.sh, support BASE_BRANCH, delegate changelog PR creation to update-release-changelog.sh, pass git identity via env, and improve argument/env handling (e.g., previous_version_ref/hotfix and test mode)

Written by Cursor Bugbot for commit e5a2948. This will update automatically on new commits. Configure here.

@jluque0101
Copy link
Contributor Author

bugbot run

@jluque0101
Copy link
Contributor Author

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no bugs!


@jluque0101
Copy link
Contributor Author

bugbot run

@jluque0101
Copy link
Contributor Author

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no bugs!


@jluque0101 jluque0101 marked this pull request as ready for review December 19, 2025 15:57
@Qbandev Qbandev requested a review from Copilot December 19, 2025 16:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the release automation scripts by extracting shared utility functions into a centralized location, improving code maintainability and reducing duplication across release workflows.

Key Changes:

  • Extract shared git/branch/PR helper functions into a reusable utilities module
  • Create standalone changelog updater script with enhanced parameterization
  • Improve branch and version handling with better defaults and validation

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
.github/scripts/utils.sh New shared utilities file containing reusable functions (configure_git, checkout_or_create_branch, push_branch_with_handling, create_pr_if_not_exists) for release scripts
.github/scripts/update-release-changelog.sh Updated to source shared utilities, add support for custom changelog branch and explicit version parameters, and improve documentation
.github/scripts/create-platform-release-pr.sh Refactored to source and use shared utilities, delegate changelog operations to standalone script, export git identity via environment variables, and add BASE_BRANCH parameterization
Comments suppressed due to low confidence (1)

.github/scripts/create-platform-release-pr.sh:49

  • The BASE_BRANCH variable is assigned on line 40 but is not included in the debug logging section (lines 42-49). For consistency with other variables and to aid in debugging, consider adding it to the log output:
echo "BASE_BRANCH: $BASE_BRANCH"
BASE_BRANCH="${BASE_BRANCH:-main}"

# Log assigned variables for debugging (after defaults and trimming)
echo "Assigned variables:"
echo "PLATFORM: $PLATFORM"
echo "PREVIOUS_VERSION_REF: $PREVIOUS_VERSION_REF"
echo "NEW_VERSION: $NEW_VERSION"
echo "NEW_VERSION_NUMBER: $NEW_VERSION_NUMBER"
echo "GIT_USER_NAME: $GIT_USER_NAME"
echo "GIT_USER_EMAIL: $GIT_USER_EMAIL"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jluque0101 jluque0101 marked this pull request as draft January 5, 2026 12:14
@jluque0101
Copy link
Contributor Author

@copilot

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jluque0101
Copy link
Contributor Author

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no bugs!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@jluque0101 jluque0101 marked this pull request as ready for review January 6, 2026 13:22
@jluque0101 jluque0101 force-pushed the chore/INFRA-3067-ref-duplication branch from 66ba953 to e5a2948 Compare January 7, 2026 09:45
@jluque0101 jluque0101 changed the title chore(INFRA-3037): refactor, remove release scripts dups fix(INFRA-3037): refactor, remove release scripts dups Jan 7, 2026
@Qbandev Qbandev requested a review from Copilot January 7, 2026 10:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +23 to +30
if git show-ref --verify --quiet "refs/heads/${branch_name}" || git ls-remote --heads origin "${branch_name}" | grep -q "${branch_name}"; then
echo "Branch ${branch_name} already exists, checking it out"
if git ls-remote --heads origin "${branch_name}" | grep -q "${branch_name}"; then
git fetch origin "${branch_name}"
git checkout "${branch_name}"
else
git checkout "${branch_name}"
fi
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

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

The branch existence check is redundant and inefficient. The condition checks both local (git show-ref) and remote (git ls-remote) existence, then the inner if-else checks remote existence again. Consider simplifying to check remote first (which will cover both cases in a distributed workflow), or restructure the logic to avoid the duplicate remote check on line 25.

Suggested change
if git show-ref --verify --quiet "refs/heads/${branch_name}" || git ls-remote --heads origin "${branch_name}" | grep -q "${branch_name}"; then
echo "Branch ${branch_name} already exists, checking it out"
if git ls-remote --heads origin "${branch_name}" | grep -q "${branch_name}"; then
git fetch origin "${branch_name}"
git checkout "${branch_name}"
else
git checkout "${branch_name}"
fi
if git ls-remote --heads origin "${branch_name}" | grep -q "${branch_name}"; then
echo "Branch ${branch_name} already exists on remote, checking it out"
git fetch origin "${branch_name}"
git checkout "${branch_name}"
elif git show-ref --verify --quiet "refs/heads/${branch_name}"; then
echo "Branch ${branch_name} already exists locally, checking it out"
git checkout "${branch_name}"

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not essential, I would prefer to keep this logic 'as it is' rather than adding more changes on top of the refactor, we could treat it in a separate ticket however

Comment on lines +315 to +321
"${SCRIPT_DIR}/update-release-changelog.sh" \
"${release_branch_name}" \
"${platform}" \
"${GITHUB_REPOSITORY_URL}" \
"${previous_version_ref}" \
"${changelog_branch_name}" \
"${new_version}"
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

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

Missing validation for GITHUB_REPOSITORY_URL environment variable. The script is called with GITHUB_REPOSITORY_URL on line 318, but there's no check to ensure this environment variable is set when TEST_ONLY is false. According to the documentation at line 25, this is required for changelog generation. Consider adding a validation check similar to other required parameters.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd like to avoid scope creep

env:
   GITHUB_REPOSITORY_URL: '${{ github.server_url }}/${{ github.repository }}'

will be always set , it would be also a redundant protection as the child script checks for the REPOSITORY_URL too.
Still, technically correct because it would 'fail fast' (main vs child script)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants