From 3c80c0b6871b3b6a45286fe5a197c285d0e917ac Mon Sep 17 00:00:00 2001 From: Jaydip Gabani Date: Thu, 2 Nov 2023 22:06:08 +0000 Subject: [PATCH] adding labels to release PR and triggering on pr merged Signed-off-by: Jaydip Gabani --- .github/workflows/release-pr.yaml | 3 +++ .github/workflows/tag.yaml | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-pr.yaml b/.github/workflows/release-pr.yaml index 6dda8e83255..7887aad5a6a 100644 --- a/.github/workflows/release-pr.yaml +++ b/.github/workflows/release-pr.yaml @@ -84,3 +84,6 @@ jobs: branch: "release-${{ env.NEWVERSION }}" base: "${{ env.TARGET_BRANCH }}" signoff: true + labels: | + release-pr + ${{ github.event.inputs.release_version }} diff --git a/.github/workflows/tag.yaml b/.github/workflows/tag.yaml index d18e3d1d98e..2f487e1b162 100644 --- a/.github/workflows/tag.yaml +++ b/.github/workflows/tag.yaml @@ -1,5 +1,7 @@ name: create_tag -on: [push] +on: + pull_request: + types: [closed] permissions: contents: write @@ -7,12 +9,14 @@ permissions: jobs: create_tag: name: "Create tag" - if: contains(github.event.head_commit.message, 'Prepare') + if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release-pr') runs-on: ubuntu-22.04 steps: - name: "Set release tag" + env: + GITHUB_CONTEXT: ${{ toJson(github.event.pull_request.labels.*.name) }} run: | - RELEASE_TAG=$(echo "${{ github.event.head_commit.message }}" | grep -o 'v[^ ,]\+' | sed -n '1p') + RELEASE_TAG=$(echo "$GITHUB_CONTEXT" | jq '.[1]') echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV - name: Check out code