Copilot commented on code in PR #4286:
URL: https://github.com/apache/streampark/pull/4286#discussion_r2335390590
##########
.github/workflows/docker-push.yml:
##########
@@ -31,12 +29,41 @@ concurrency:
cancel-in-progress: true
jobs:
+ get-tags:
+ runs-on: ubuntu-latest
+ if: ${{ github.repository == 'apache/streampark' && github.event_name ==
'schedule' }}
+ outputs:
+ tags: ${{ steps.get-tags.outputs.tags }}
+ steps:
+ - name: Check out the repo
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Get all matching tags
+ id: get-tags
+ run: |
+ # 获取所有符合规则的标签
+ TAGS=$(git tag -l | grep -E '^v[2-9]+\.[0-9]+\.[0-9]+$' | sort -V)
+ echo "Found tags: $TAGS"
+
+ # 将标签转换为 JSON 数组格式
+ TAGS_JSON=$(echo "$TAGS" | jq -R -s -c 'split("\n")[:-1]')
+ echo "tags=$TAGS_JSON" >> $GITHUB_OUTPUT
+ echo "Found $TAGS_JSON"
Review Comment:
The comments are written in Chinese. For better maintainability in an
international project, consider using English comments. For example: '# Get all
tags matching the pattern' and '# Convert tags to JSON array format'.
##########
.github/workflows/docker-push.yml:
##########
@@ -31,12 +29,41 @@ concurrency:
cancel-in-progress: true
jobs:
+ get-tags:
+ runs-on: ubuntu-latest
+ if: ${{ github.repository == 'apache/streampark' && github.event_name ==
'schedule' }}
+ outputs:
+ tags: ${{ steps.get-tags.outputs.tags }}
+ steps:
+ - name: Check out the repo
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Get all matching tags
+ id: get-tags
+ run: |
+ # 获取所有符合规则的标签
+ TAGS=$(git tag -l | grep -E '^v[2-9]+\.[0-9]+\.[0-9]+$' | sort -V)
+ echo "Found tags: $TAGS"
+
+ # 将标签转换为 JSON 数组格式
+ TAGS_JSON=$(echo "$TAGS" | jq -R -s -c 'split("\n")[:-1]')
+ echo "tags=$TAGS_JSON" >> $GITHUB_OUTPUT
+ echo "Found $TAGS_JSON"
+
build_image:
runs-on: ubuntu-latest
- if: ${{ github.repository == 'apache/streampark' }}
+ if: ${{ github.repository == 'apache/streampark' && (github.event_name ==
'push' || (github.event_name == 'schedule' && needs.get-tags.outputs.tags !=
'[]')) }}
Review Comment:
[nitpick] The conditional expression is complex and hard to read. Consider
breaking it into multiple lines or using a more readable format for better
maintainability.
##########
.github/workflows/docker-push.yml:
##########
@@ -31,12 +29,41 @@ concurrency:
cancel-in-progress: true
jobs:
+ get-tags:
+ runs-on: ubuntu-latest
+ if: ${{ github.repository == 'apache/streampark' && github.event_name ==
'schedule' }}
+ outputs:
+ tags: ${{ steps.get-tags.outputs.tags }}
+ steps:
+ - name: Check out the repo
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Get all matching tags
+ id: get-tags
+ run: |
+ # 获取所有符合规则的标签
+ TAGS=$(git tag -l | grep -E '^v[2-9]+\.[0-9]+\.[0-9]+$' | sort -V)
+ echo "Found tags: $TAGS"
+
+ # 将标签转换为 JSON 数组格式
+ TAGS_JSON=$(echo "$TAGS" | jq -R -s -c 'split("\n")[:-1]')
+ echo "tags=$TAGS_JSON" >> $GITHUB_OUTPUT
+ echo "Found $TAGS_JSON"
+
build_image:
runs-on: ubuntu-latest
- if: ${{ github.repository == 'apache/streampark' }}
+ if: ${{ github.repository == 'apache/streampark' && (github.event_name ==
'push' || (github.event_name == 'schedule' && needs.get-tags.outputs.tags !=
'[]')) }}
+ needs: get-tags
+ strategy:
+ matrix:
+ tag: ${{ fromJson(needs.get-tags.outputs.tags) }}
Review Comment:
The `needs: get-tags` dependency will cause the job to fail when
`github.event_name == 'push'` because the `get-tags` job only runs on scheduled
events. This creates a dependency on a job that may not exist, causing the
workflow to fail on push events.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]