From a8581fb610d4573cb6787b89eef71154a7126a1f Mon Sep 17 00:00:00 2001 From: EstrellaXD Date: Fri, 30 Jun 2023 12:31:49 +0800 Subject: [PATCH] change: update pr workflow --- .github/workflows/release.yml | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a4a2b4dd..cc2acdc5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,12 +8,28 @@ on: - main jobs: - generate_release_draft: - runs-on: ubuntu-latest + check_pr_title: if: > github.event.pull_request.merged == true && - github.event.pull_request.base.ref == 'main' && - github.event.pull_request.title =~ '^v(\d+\.\d+\.\d+)$' + github.event.pull_request.base.ref == 'main' + runs-on: ubuntu-latest + outputs: + version_pr: ${{ steps.check.outputs.version_pr }} + steps: + - name: Check if PR title is version + id: check + run: | + if [[ "${{ github.event.pull_request.title }}" =~ ^([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then + echo "::set-output name=version_pr::true" + else + echo "::set-output name=version_pr::false" + fi + + generate_release_draft: + needs: check_pr_title + if: + needs.check_pr_title.outputs.version_pr == 'true' + runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2