Repository navigation
Add OBS HK cross-region stability test workflow #209
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | ||
|
Check warning on line 1 in .github/workflows/bot_pr_create.yaml
|
||
| # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # This file is a part of the vllm-ascend project. | ||
| # | ||
| name: PR Create | ||
| on: | ||
| pull_request_target: | ||
| permissions: | ||
| pull-requests: write | ||
| jobs: | ||
| pr-create: | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| name: PR create action | ||
| runs-on: linux-amd64-cpu-2-hk | ||
| container: | ||
| image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/vllm-ascend/act-environments-ubuntu:act-22.04 | ||
| steps: | ||
| - name: Install system dependencies | ||
| run: | | ||
| sudo mkdir -p -m 755 /etc/apt/keyrings | ||
| curl -sL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null | ||
| sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg | ||
| echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null | ||
| sudo apt-get update -y | ||
| sudo apt-get install gh -y | ||
| - name: Fetch required files | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| REPO="${{ github.repository }}" | ||
| REF="${{ github.event.pull_request.base.ref }}" | ||
| mkdir -p .github | ||
| for file in vllm-main-verified.commit vllm-release-tag.commit labeler.yml; do | ||
| curl -sSf -H "Authorization: Bearer $GITHUB_TOKEN" \ | ||
| "https://api.github.com/repos/$REPO/contents/.github/$file?ref=$REF" \ | ||
| | jq -r '.content' | base64 -d > ".github/$file" | ||
| done | ||
| - name: Get vLLM version | ||
| run: | | ||
| VLLM_COMMIT=$(tr -d '[:space:]' < .github/vllm-main-verified.commit) | ||
| echo "VLLM_COMMIT=https://github.com/vllm-project/vllm/commit/$VLLM_COMMIT" >> "$GITHUB_ENV" | ||
| VLLM_VERSION=$(tr -d '[:space:]' < .github/vllm-release-tag.commit) | ||
| echo "VLLM_VERSION=$VLLM_VERSION" >> "$GITHUB_ENV" | ||
| - name: Update PR description | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| GH_REPO: ${{ github.repository }} | ||
| run: | | ||
| PR_NUMBER=${{ github.event.number }} | ||
| VLLM_VERSION=${{ env.VLLM_VERSION }} | ||
| VLLM_COMMIT=${{ env.VLLM_COMMIT }} | ||
| OLD=/tmp/orig_pr_body.txt | ||
| NEW=/tmp/new_pr_body.txt | ||
| FINAL=/tmp/final_pr_body.txt | ||
| gh pr view --json body --template "{{.body}}" "${PR_NUMBER}" > "${OLD}" | ||
| cp "${OLD}" "${NEW}" | ||
| # Remove notes in pr description and add vLLM version and commit | ||
| sed -i '/<!--/,/-->/d' "${NEW}" | ||
| sed -i '/- vLLM .*$/d' "${NEW}" | ||
| { | ||
| echo "" | ||
| echo "- vLLM version: $VLLM_VERSION" | ||
| echo "- vLLM main: $VLLM_COMMIT" | ||
| } >> "${NEW}" | ||
| # Remove redundant empty lines | ||
| uniq "${NEW}" > "${FINAL}" | ||
| # Run this only if ${NEW} is different than ${OLD} | ||
| if ! cmp -s "${OLD}" "${FINAL}"; then | ||
| echo | ||
| echo "Updating PR body:" | ||
| echo | ||
| cat "${NEW}" | ||
| gh pr edit --body-file "${FINAL}" "${PR_NUMBER}" | ||
| else | ||
| echo "No changes needed" | ||
| fi | ||
| - name: Label the PR | ||
| uses: actions/labeler@v6 | ||
| with: | ||
| repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
| configuration-path: .github/labeler.yml | ||
| sync-labels: true | ||
| - name: Remind contributors on PR open | ||
| if: github.event.action == 'opened' | ||
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | ||
| with: | ||
| script: | | ||
| const title = context.payload.pull_request.title.toLowerCase(); | ||
| const isBugFix = title.includes('[bugfix]'); | ||
| const isFeature = title.includes('[feature]'); | ||
| const typeLabel = isBugFix && isFeature ? '[BugFix]/[Feature]' : (isBugFix ? '[BugFix]' : '[Feature]'); | ||
| let body = '👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:\n\n' + | ||
| '- A PR should do only one thing, smaller PRs enable faster reviews.\n' + | ||
| '- Every PR should include unit tests and end-to-end tests to ensure it works and is not broken by other future PRs.\n' + | ||
| '- Write the commit message by fulfilling the PR description to help reviewer and future developers understand.\n\n' + | ||
| 'If CI fails, you can run linting and testing checks locally according [Contributing](https://docs.vllm.ai/projects/ascend/zh-cn/latest/developer_guide/contribution/index.html) and [Testing](https://docs.vllm.ai/projects/ascend/zh-cn/latest/developer_guide/contribution/testing.html).\n'; | ||
| if (isBugFix || isFeature) { | ||
| body += '\n---\n\n' + | ||
| '> [!TIP]\n' + | ||
| '> ## :bulb: Consider Linking a Related Issue or RFC\n' + | ||
| '>\n' + | ||
| '> Your PR title contains the **' + typeLabel + '** tag, indicating a bug fix or new feature.\n' + | ||
| '>\n' + | ||
| '> Linking a related issue or RFC in the PR description is **strongly encouraged** — it gives reviewers helpful context and speeds up the review. You can use any of these keywords:\n' + | ||
| '>\n' + | ||
| '> - `Fixes #<issue_number>`\n' + | ||
| '> - `Closes #<issue_number>`\n' + | ||
| '> - `Resolves #<issue_number>`\n' + | ||
| '> - `Refs #<rfc_or_issue_number>` (for RFCs)\n' + | ||
| '>\n' + | ||
| '> :pray: Thanks for helping us keep the project well-organized!\n'; | ||
| } | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| body: body | ||
| }); | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||