Skip to content

Commit

Permalink
[Tool] Add issue checker for feature prs (backport #44542) (#44609)
Browse files Browse the repository at this point in the history
Signed-off-by: andyziye <[email protected]>
Co-authored-by: andyziye <[email protected]>
  • Loading branch information
mergify[bot] and andyziye authored Apr 23, 2024
1 parent a39cbc2 commit 9a3ceee
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 73 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/approve-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,3 @@ jobs:
run: |
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull >/dev/null
./scripts/check-approve.sh
feature-review:
needs: info
runs-on: [ self-hosted, normal ]
if: github.event_name == 'pull_request_review' && contains(needs.info.outputs.LABELS, 'feature') && !contains(needs.info.outputs.LABELS, 'sync')
name: FEATURE-REVIEW

env:
PR_NUMBER: ${{ needs.info.outputs.PR_NUMBER }}
REPO: ${{ github.repository }}
TEAM: feature-reviewer
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: FEATURE-REVIEW
run: |
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull >/dev/null
./scripts/check-approve.sh
15 changes: 15 additions & 0 deletions .github/workflows/ci-merged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ permissions:
pull-requests: write
issues: write
actions: write
env:
PR_NUMBER: ${{ github.event.number }}

jobs:
backport:
Expand Down Expand Up @@ -178,6 +180,8 @@ jobs:
github.base_ref != 'main' && github.event.pull_request.merged == true
env:
PR_NUMBER: ${{ github.event.number }}
outputs:
VERSION_LABEL: ${{ steps.prepare_version_label.outputs.LABEL }}
steps:
- name: prepare merge label
if: >
Expand Down Expand Up @@ -221,3 +225,14 @@ jobs:
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
if: !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 }}
steps:
- name: Update Issue Body & 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} ${VERSION_LABEL}
6 changes: 6 additions & 0 deletions .github/workflows/ci-pipeline-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ jobs:
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull >/dev/null
./scripts/check-blacklist.sh
- name: Check Feature Issue
id: check_issue
run: |
cd ci-tool
python3 scripts/get_pr_issue.py check_issue ${GITHUB_REPOSITORY} ${PR_NUMBER}
be-checker:
runs-on: ubuntu-latest
needs: basic-checker
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/ci-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ jobs:
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull >/dev/null
./scripts/check-blacklist.sh
- name: Check Feature Issue
id: check_issue
run: |
cd ci-tool
python3 scripts/get_pr_issue.py check_issue ${GITHUB_REPOSITORY} ${PR_NUMBER}
be-checker:
runs-on: ubuntu-latest
needs: basic-checker
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/inspection-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ jobs:
[[ "$GITHUB_REPOSITORY" == 'StarRocks/starrocks' ]] && all_linux=true
elif [[ "${{ github.event.schedule }}" == "30 0 * * 1-5" ]]; then
branch=main
all_linux=true
if [[ `date +%u` -eq 1 || `date +%u` -eq 4 ]]; then
all_linux=true
fi
else
branch=main
fi
Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/label-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,33 +80,3 @@ jobs:
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/pulls/${PR_NUMBER}/requested_reviewers \
-f "reviewers[]=" -f "team_reviewers[]=${PROTO_TEAM}" 1>/dev/null
feature-review:
name: FEATURE REVIEW LABEL
if: github.event.label.name == 'feature'
runs-on: ubuntu-latest
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
TEAM: feature-reviewer
GH_TOKEN: ${{ secrets.PAT }}

steps:
- name: ADD REVIEWER
if: github.event.action == 'labeled'
run: |
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/pulls/${PR_NUMBER}/requested_reviewers \
-f "reviewers[]=" -f "team_reviewers[]=${TEAM}" 1>/dev/null
- name: REMOVE REVIEWER
if: github.event.action == 'unlabeled'
run: |
gh api \
--method DELETE \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/pulls/${PR_NUMBER}/requested_reviewers \
-f "reviewers[]=" -f "team_reviewers[]=${TEAM}" 1>/dev/null
6 changes: 0 additions & 6 deletions .github/workflows/notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,3 @@ jobs:
run: |
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull && source lib/init.sh
python3 lib/notify_outer_issue_pr.py
- name: feature notification
if: always()
run: |
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull && source lib/init.sh
python3 lib/notify_feature_pr.py
18 changes: 0 additions & 18 deletions .github/workflows/pr-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,24 +266,6 @@ jobs:
pull-request-number: ${{ github.event.pull_request.number }}
merge-method: squash

feature-label-check:
runs-on: ubuntu-latest
steps:
- name: add feature label
id: add
if: startsWith(github.event.pull_request.title, '[Feature]')
uses: actions-ecosystem/action-add-labels@v1
with:
labels: 'feature'
github_token: ${{ secrets.PAT }}

- name: remove feature label
if: always() && steps.add.outcome == 'skipped'
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: 'feature'
github_token: ${{ secrets.PAT }}

changelist-check:
runs-on: [self-hosted, normal]
if: >
Expand Down

0 comments on commit 9a3ceee

Please sign in to comment.