Skip to content

feat: bump version for develop and main branch#95

Merged
Junyi-99 merged 3 commits intomainfrom
feat/github-action
Jan 23, 2026
Merged

feat: bump version for develop and main branch#95
Junyi-99 merged 3 commits intomainfrom
feat/github-action

Conversation

@Junyi-99
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings January 23, 2026 21:11
@Junyi-99 Junyi-99 self-assigned this Jan 23, 2026
@Junyi-99 Junyi-99 merged commit b88eac9 into main Jan 23, 2026
4 checks passed
@Junyi-99 Junyi-99 deleted the feat/github-action branch January 23, 2026 21:11
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 enhances the version bumping workflow to support both develop and main branches with different versioning strategies. The develop branch will bump patch versions (e.g., v2.1.2 → v2.1.3) while the main branch will bump minor versions and reset patch to 0 (e.g., v2.1.2 → v2.2.0). The changes also migrate the build workflows from workflow_run triggers to repository_dispatch events for more precise control.

Changes:

  • Modified bump-version.yml to trigger on both main and develop branches with branch-specific version bumping logic
  • Updated all build workflows to use repository_dispatch instead of workflow_run triggers
  • Changed repository dispatch event types from generic 'release' to environment-specific 'prd' and 'stg'

Reviewed changes

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

Show a summary per file
File Description
.github/workflows/bump-version.yml Added develop branch trigger and conditional version bumping logic; split repository dispatch into separate prd and stg events
.github/workflows/build-ext-stg.yml Changed trigger from workflow_run to repository_dispatch with 'stg' event type
.github/workflows/build-ext-prd.yml Changed trigger from workflow_run to repository_dispatch with 'prd' event type
.github/workflows/build-backend-stg.yml Updated repository_dispatch event type from 'release' to 'stg'
.github/workflows/build-backend-prd.yml Updated repository_dispatch event type from 'release' to 'prd'
Comments suppressed due to low confidence (2)

.github/workflows/build-ext-stg.yml:14

  • The checkout action is not configured to use the tag passed in the repository_dispatch event. When triggered by repository_dispatch, this workflow will checkout the default branch instead of the newly created tag. Add a 'ref' parameter to checkout the correct tag using the client_payload data, for example: 'ref: ${{ github.event.client_payload.tag }}'
      - name: Checkout code
        uses: actions/checkout@v4
        with:
          fetch-depth: 0  # 获取完整历史

.github/workflows/build-ext-prd.yml:14

  • The checkout action is not configured to use the tag passed in the repository_dispatch event. When triggered by repository_dispatch, this workflow will checkout the default branch instead of the newly created tag. Add a 'ref' parameter to checkout the correct tag using the client_payload data, for example: 'ref: ${{ github.event.client_payload.tag }}'
      - name: Checkout code
        uses: actions/checkout@v4
        with:
          fetch-depth: 0  # 获取完整历史

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

Comment on lines 6 to +7
repository_dispatch:
types: [release]
types: [stg]
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

This workflow is now triggered by repository_dispatch with a tag in the client_payload, but the existing checkout step at line 19-20 (not shown in diff) doesn't specify a 'ref' parameter. This means it will checkout the default branch instead of the newly created tag. The checkout action needs to be updated to include 'ref: ${{ github.event.client_payload.tag }}' to checkout the correct tag version.

Copilot uses AI. Check for mistakes.
Comment on lines 6 to +7
repository_dispatch:
types: [release]
types: [prd]
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

This workflow is now triggered by repository_dispatch with a tag in the client_payload, but the existing checkout step at line 19-20 (not shown in diff) doesn't specify a 'ref' parameter. This means it will checkout the default branch instead of the newly created tag. The checkout action needs to be updated to include 'ref: ${{ github.event.client_payload.tag }}' to checkout the correct tag version.

Copilot uses AI. Check for mistakes.
# Reassemble
new_version="${parts[0]}"
for i in $(seq 1 $last_index); do
for i in $(seq 1 $((${#parts[@]} - 1))); do
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

The version reassembly logic has an edge case issue. If the version has only one part (e.g., 'v1'), the seq command will receive 'seq 1 0' which produces no output, resulting in 'new_version' being just the major version without any dots or additional parts. Consider adding a check for the number of version parts or using a different approach to reassemble the version string.

Suggested change
for i in $(seq 1 $((${#parts[@]} - 1))); do
for ((i=1; i<${#parts[@]}; i++)); do

Copilot uses AI. Check for mistakes.
Comment on lines +44 to +54
elif [ "$branch" = "main" ]; then
# Main branch: bump minor version and set patch to 0
# v2.1.2 --> v2.2.0
if [ ${#parts[@]} -ge 2 ]; then
parts[1]=$((parts[1] + 1))
# Set patch version to 0
if [ ${#parts[@]} -ge 3 ]; then
parts[2]=0
fi
fi
fi
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

The main branch version bumping logic only handles cases where there are at least 2 version parts. If the version has only 1 part (e.g., 'v1'), no bumping occurs and the version remains unchanged. Consider adding an else clause to handle this edge case or ensuring that versions always have at least 3 parts (major.minor.patch).

Copilot uses AI. Check for mistakes.
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