diff --git a/.github/format_pr_body.sh b/.github/format_pr_body.sh new file mode 100755 index 0000000..6dac575 --- /dev/null +++ b/.github/format_pr_body.sh @@ -0,0 +1,52 @@ +# +# 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. +# + +#!/bin/bash + +set -eux + +# ensure 2 argument is passed +if [ "$#" -ne 3 ]; then + echo "Usage: $0 " + exit 1 +fi + +PR_NUMBER=$1 +VLLM_VERSION=$2 +VLLM_COMMIT=$3 +OLD=/tmp/orig_pr_body.txt +NEW=/tmp/new_pr_body.txt + +gh pr view --json body --template "{{.body}}" "${PR_NUMBER}" > "${OLD}" +cp "${OLD}" "${NEW}" + +# Remove "FIX #xxxx (*link existing issues this PR will resolve*)" +sed -i '//d' "${NEW}" +sed -i '/- vLLM .*$/d' "${NEW}" +echo "- vLLM version: $VLLM_VERSION" >> "${NEW}" +echo "- vLLM main: $VLLM_COMMIT" >> "${NEW}" + +# Run this only if ${NEW} is different than ${OLD} +if ! cmp -s "${OLD}" "${NEW}"; then + echo + echo "Updating PR body:" + echo + cat "${NEW}" + gh pr edit --body-file "${NEW}" "${PR_NUMBER}" +else + echo "No changes needed" +fi diff --git a/.github/workflows/format_pr_body.yaml b/.github/workflows/format_pr_body.yaml new file mode 100644 index 0000000..2c91ab2 --- /dev/null +++ b/.github/workflows/format_pr_body.yaml @@ -0,0 +1,63 @@ +# +# 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: format / pr body + +on: + # The PR updated when PR opened and push new commits + pull_request_target: + types: [opened, synchronize] + branches: + - 'main' + +permissions: + pull-requests: write + +jobs: + update-description: + name: update vLLM version + runs-on: ubuntu-latest + + steps: + - name: Checkout vllm-project/vllm repo + uses: actions/checkout@v4 + with: + repository: vllm-project/vllm + path: ./vllm-empty + + - name: Get vLLM version + working-directory: ./vllm-empty + run: | + VLLM_COMMIT=$(git rev-parse HEAD) + echo "VLLM_COMMIT=https://github.com/vllm-project/vllm/commit/$VLLM_COMMIT" >> $GITHUB_ENV + + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Set up Python + uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 + + - name: Get vLLM release version + run: | + VLLM_VERSION=$(python3 docs/source/conf.py | jq .vllm_version | tr -d '"') + echo "VLLM_VERSION=$VLLM_VERSION" >> $GITHUB_ENV + + - name: Update PR description + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + bash .github/format_pr_body.sh "${{ github.event.number }}" "${{ env.VLLM_VERSION }}" "${{ env.VLLM_COMMIT }}"