From ac6bb7b452cfe58956a32c89acbf4e3a284dda3d Mon Sep 17 00:00:00 2001
From: "Mahatthana (Kelvin) Nomsawadi" <me@bboykelvin.dev>
Date: Thu, 6 Jun 2024 14:42:24 +0700
Subject: [PATCH] Followed-up tasks for changelog generation (#43656)

* Check git tag for an exact match

* Set npm publish to dry run, so I can test

* Uses new github automation account for creating a PR

* Remove unnecessary step

* Automatically set `no-backport` on the SDK doc version bump PR

* Fix step to edit PR with correct permission

* Remove npm dry run after finished testing
---
 .github/workflows/release-embedding-sdk.yml | 31 +++++++++++----------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/.github/workflows/release-embedding-sdk.yml b/.github/workflows/release-embedding-sdk.yml
index 0ce91b47b00..7358e7aea39 100644
--- a/.github/workflows/release-embedding-sdk.yml
+++ b/.github/workflows/release-embedding-sdk.yml
@@ -35,7 +35,7 @@ jobs:
 
       - name: check tags
         run: |
-          if [ $(git tag -l | grep $tag) ]
+          if [ $(git tag -l | grep $tag$) ]
           then
             echo "::error::Tag '${{ env.tag }}' already exists. If you expect to run this workflow with the same tag, please remove the tag first and rerun this workflow again."
             exit 1
@@ -168,8 +168,8 @@ jobs:
 
       - name: Setup git user
         run: |
-          git config --global user.email "metabase-bot@metabase.com"
-          git config --global user.name "Metabase bot"
+          git config --global user.email "github-automation@metabase.com"
+          git config --global user.name "Metabase Automation"
 
       # TODO: Remove this step after the build utils script is merged to master
       - name: Download release utils script
@@ -196,12 +196,6 @@ jobs:
         run: |
           mv CHANGELOG.md ./enterprise/frontend/src/embedding-sdk/CHANGELOG.md
 
-      - uses: actions/create-github-app-token@v1
-        id: app-token
-        with:
-          app-id: ${{ secrets.METABASE_BOT_APP_ID }}
-          private-key: ${{ secrets.METABASE_BOT_APP_PRIVATE_KEY }}
-
       - name: Create a PR updating readme + published version, and changelog
         run: |
           git checkout -b update-sdk-version-${{ inputs.sdk_version }}
@@ -211,7 +205,18 @@ jobs:
                        --assignee "${GITHUB_ACTOR}"\
                        --title "Update SDK version to ${{ inputs.sdk_version }}"\
                        --body "Update Readme version references and published npm package version to ${{ inputs.sdk_version }}"
-          gh pr edit --add-reviewer @metabase/embedding
+        env:
+          GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
+
+      - uses: actions/create-github-app-token@v1
+        id: app-token
+        with:
+          app-id: ${{ secrets.METABASE_BOT_APP_ID }}
+          private-key: ${{ secrets.METABASE_BOT_APP_PRIVATE_KEY }}
+
+      - name: Edit PR adding useful information
+        run: |
+          gh pr edit --add-reviewer @metabase/embedding --add-label no-backport
         env:
           GH_TOKEN: ${{ steps.app-token.outputs.token }}
 
@@ -239,11 +244,7 @@ jobs:
         with:
           ref: ${{ inputs.git_ref }}
 
-      - name: Setup git user
-        run: |
-          git config --global user.email "metabase-bot@metabase.com"
-          git config --global user.name "Metabase bot"
-
+      # Lightweight tags don't need committer name and email
       - name: Create a new git tag
         run: |
           git tag ${{ env.tag }}
-- 
GitLab