[Tool] Add version label to issue when main pr was merged (#44602)

Signed-off-by: AndyZiYe <yeziyu@starrocks.com>
This commit is contained in:
andyziye 2024-04-23 16:55:04 +08:00 committed by GitHub
parent 70fe819b51
commit d3ef2ba133
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 51 additions and 7 deletions

View File

@ -238,16 +238,58 @@ jobs:
VERSION_LABEL: ${{ steps.prepare_version_label.outputs.LABEL }}
run: |
gh pr edit ${PR_NUMBER} -R ${GITHUB_REPOSITORY} --add-label "${VERSION_LABEL}"
update_feature_issue:
update_version_label_for_main_feature:
runs-on: [ self-hosted, quick ]
needs: update_backport_merged_msg
if: >
!contains(github.event.pull_request.labels.*.name, 'sync') && startsWith(github.event.pull_request.title, '[Feature]')
github.base_ref == 'main' && github.event.pull_request.merged == true &&
!contains(github.event.pull_request.labels.*.name, 'sync') &&
startsWith(github.event.pull_request.title, '[Feature]')
env:
VERSION_LABEL: ${{ needs.update_backport_merged_msg.outputs.VERSION_LABEL }}
PR_NUMBER: ${{ github.event.number }}
outputs:
VERSION_LABEL: ${{ steps.prepare_version_label.outputs.LABEL }}
steps:
- name: Update Issue Body & Label
- name: prepare version label
id: prepare_version_label
if: always()
env:
GH_TOKEN: ${{ secrets.PAT }}
run: |
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull >/dev/null
python3 scripts/get_pr_issue.py update_issue ${GITHUB_REPOSITORY} ${PR_NUMBER} ${VERSION_LABEL}
version=$(./scripts/get_next_release_tag.sh)
version_label="version:${version}"
echo "LABEL=${version_label}" >> $GITHUB_OUTPUT
gh label create "${version_label}" -R ${GITHUB_REPOSITORY} -c 1d76db -f
- name: add version label
if: always()
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION_LABEL: ${{ steps.prepare_version_label.outputs.LABEL }}
run: |
gh pr edit ${PR_NUMBER} -R ${GITHUB_REPOSITORY} --add-label "${VERSION_LABEL}"
update_feature_issue:
runs-on: [ self-hosted, quick ]
needs:
- update_backport_merged_msg
- update_version_label_for_main_feature
if: >
always() && !contains(github.event.pull_request.labels.*.name, 'sync') && startsWith(github.event.pull_request.title, '[Feature]')
env:
BRANCH_VERSION_LABEL: ${{ needs.update_backport_merged_msg.outputs.VERSION_LABEL }}
MAIN_VERSION_LABEL: ${{ needs.update_version_label_for_main_feature.outputs.VERSION_LABEL }}
steps:
- name: Update Issue Body & Label(main)
if: github.base_ref == 'main' && env.MAIN_VERSION_LABEL != ''
run: |
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull >/dev/null
python3 scripts/get_pr_issue.py update_issue ${GITHUB_REPOSITORY} ${PR_NUMBER} ${MAIN_VERSION_LABEL}
- name: Update Issue Body & Label(branch)
if: always() && github.base_ref != 'main' && env.BRANCH_VERSION_LABEL != ''
run: |
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull >/dev/null
python3 scripts/get_pr_issue.py update_issue ${GITHUB_REPOSITORY} ${PR_NUMBER} ${BRANCH_VERSION_LABEL}

View File

@ -161,6 +161,7 @@ jobs:
path: image_cache.info
retention-days: 1
overwrite: true
if-no-files-found: ignore
- name: Clean ENV
if: always()

View File

@ -173,6 +173,7 @@ jobs:
path: image_cache.info
retention-days: 1
overwrite: true
if-no-files-found: ignore
- name: Clean ENV
if: always() && needs.be-checker.outputs.thirdparty_filter == 'true'