From cd698bc90518d83de07bd5b98db979cf72d898f7 Mon Sep 17 00:00:00 2001 From: Vivek Shindhe Date: Fri, 20 Dec 2024 01:29:41 +0530 Subject: [PATCH 01/16] chore: checkout SDK version made static again --- .github/workflows/version_update_trigger.yml | 45 ++++++++++++++++++++ android/build.gradle | 2 +- package.json | 2 +- yarn.lock | 4 ++ 4 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/version_update_trigger.yml create mode 100644 yarn.lock diff --git a/.github/workflows/version_update_trigger.yml b/.github/workflows/version_update_trigger.yml new file mode 100644 index 00000000..8393b89d --- /dev/null +++ b/.github/workflows/version_update_trigger.yml @@ -0,0 +1,45 @@ +name: Version trigger workflow + +on: + pull_request: + +jobs: + build: + runs-on: self-hosted + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Fetch the pull request diff + run: git fetch origin ${{ github.event.pull_request.base.sha }} ${{ github.sha }} + + - name: Check if a particular file has changed + id: check_file + run: | + # Check if 'package.json' has changed in the PR + if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -q 'package.json'; then + echo "file_changed=true" >> $GITHUB_ENV + else + echo "file_changed=false" >> $GITHUB_ENV + fi + + - name: Take action based on file change + if: env.file_changed == 'true' + run: | + echo "version_line=$(grep -m 1 "\"version\":" ${GITHUB_WORKSPACE}/package.json)" >> $GITHUB_ENV + + - name: Post a comment on the PR + if: env.file_changed == 'true' + uses: actions/github-script@v6 + with: + script: | + const pr_number = ${GITHUB_REF.split('/')[2]}; + const message = "$version_line\nSDK: React-Native Standard Checkout SDK"; + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr_number, + body: message, + }) \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index 99a13502..6acd33f0 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -20,6 +20,6 @@ android { dependencies { implementation 'com.facebook.react:react-native:+' - implementation 'com.razorpay:checkout:1.6.+' + implementation 'com.razorpay:checkout:1.6.41' } diff --git a/package.json b/package.json index e89cbab3..915b2179 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-razorpay", - "version": "2.3.0", + "version": "2.3.1", "description": "React Native wrapper for Razorpay", "main": "RazorpayCheckout.js", "scripts": { diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 00000000..fb57ccd1 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,4 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + From 9548ea892d6aa8784379c67536164aab2d883851 Mon Sep 17 00:00:00 2001 From: Vivek Shindhe Date: Fri, 20 Dec 2024 01:33:10 +0530 Subject: [PATCH 02/16] Update version_update_trigger.yml --- .github/workflows/version_update_trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/version_update_trigger.yml b/.github/workflows/version_update_trigger.yml index 8393b89d..8a6a30b4 100644 --- a/.github/workflows/version_update_trigger.yml +++ b/.github/workflows/version_update_trigger.yml @@ -5,7 +5,7 @@ on: jobs: build: - runs-on: self-hosted + runs-on: [self-hosted, k8s-runner] steps: - name: Checkout code From a44b92afa84bf1336acac34e8e8047bfe4ff0878 Mon Sep 17 00:00:00 2001 From: Vivek Shindhe Date: Fri, 20 Dec 2024 01:34:38 +0530 Subject: [PATCH 03/16] Update version_update_trigger.yml --- .github/workflows/version_update_trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/version_update_trigger.yml b/.github/workflows/version_update_trigger.yml index 8a6a30b4..3c5b9e5d 100644 --- a/.github/workflows/version_update_trigger.yml +++ b/.github/workflows/version_update_trigger.yml @@ -35,7 +35,7 @@ jobs: with: script: | const pr_number = ${GITHUB_REF.split('/')[2]}; - const message = "$version_line\nSDK: React-Native Standard Checkout SDK"; + const message = "pg-core-sdk-version-update\n$version_line\nSDK: React-Native Standard Checkout SDK"; await github.rest.issues.createComment({ owner: context.repo.owner, From 8a1ec335f9b5951162a42c22fa3254135113373e Mon Sep 17 00:00:00 2001 From: Vivek Shindhe Date: Fri, 20 Dec 2024 01:50:37 +0530 Subject: [PATCH 04/16] Update version_update_trigger.yml --- .github/workflows/version_update_trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/version_update_trigger.yml b/.github/workflows/version_update_trigger.yml index 3c5b9e5d..5b03dc32 100644 --- a/.github/workflows/version_update_trigger.yml +++ b/.github/workflows/version_update_trigger.yml @@ -5,7 +5,7 @@ on: jobs: build: - runs-on: [self-hosted, k8s-runner] + runs-on: macos-latest steps: - name: Checkout code From e5b1a51ee81a6221ec0623d79f88fe2100077a17 Mon Sep 17 00:00:00 2001 From: Vivek Shindhe Date: Fri, 20 Dec 2024 01:54:33 +0530 Subject: [PATCH 05/16] github-script bug fix --- .github/workflows/version_update_trigger.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/version_update_trigger.yml b/.github/workflows/version_update_trigger.yml index 5b03dc32..255faed7 100644 --- a/.github/workflows/version_update_trigger.yml +++ b/.github/workflows/version_update_trigger.yml @@ -34,8 +34,8 @@ jobs: uses: actions/github-script@v6 with: script: | - const pr_number = ${GITHUB_REF.split('/')[2]}; - const message = "pg-core-sdk-version-update\n$version_line\nSDK: React-Native Standard Checkout SDK"; + const pr_number = `${GITHUB_REF.split('/')[2]};` + const message = `pg-core-sdk-version-update\n$version_line\nSDK: React-Native Standard Checkout SDK";` await github.rest.issues.createComment({ owner: context.repo.owner, From c8d8808f3808ed84f5f02a86faf94f8c6dabc7b0 Mon Sep 17 00:00:00 2001 From: Vivek Shindhe Date: Fri, 20 Dec 2024 01:59:01 +0530 Subject: [PATCH 06/16] Update version_update_trigger.yml --- .github/workflows/version_update_trigger.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/version_update_trigger.yml b/.github/workflows/version_update_trigger.yml index 255faed7..68f5b75a 100644 --- a/.github/workflows/version_update_trigger.yml +++ b/.github/workflows/version_update_trigger.yml @@ -34,12 +34,12 @@ jobs: uses: actions/github-script@v6 with: script: | - const pr_number = `${GITHUB_REF.split('/')[2]};` + const message = `pg-core-sdk-version-update\n$version_line\nSDK: React-Native Standard Checkout SDK";` await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, - issue_number: pr_number, + issue_number: context.issue.number, body: message, }) \ No newline at end of file From 398f95c4ad76d37d65b43ce45571b03f517550ae Mon Sep 17 00:00:00 2001 From: Vivek Shindhe Date: Fri, 20 Dec 2024 13:47:50 +0530 Subject: [PATCH 07/16] Update version_update_trigger.yml --- .github/workflows/version_update_trigger.yml | 33 ++++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/version_update_trigger.yml b/.github/workflows/version_update_trigger.yml index 68f5b75a..10f53215 100644 --- a/.github/workflows/version_update_trigger.yml +++ b/.github/workflows/version_update_trigger.yml @@ -24,22 +24,21 @@ jobs: echo "file_changed=false" >> $GITHUB_ENV fi - - name: Take action based on file change + - name: Post message to Slack if: env.file_changed == 'true' run: | - echo "version_line=$(grep -m 1 "\"version\":" ${GITHUB_WORKSPACE}/package.json)" >> $GITHUB_ENV - - - name: Post a comment on the PR - if: env.file_changed == 'true' - uses: actions/github-script@v6 - with: - script: | - - const message = `pg-core-sdk-version-update\n$version_line\nSDK: React-Native Standard Checkout SDK";` - - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - body: message, - }) \ No newline at end of file + #get version_line from package.json + version_line=$(grep -m 1 "\"version\":" ${GITHUB_WORKSPACE}/package.json) + #versionName substring generation + pattern1="\"version\": \"" + pattern2="\"," + versionName=${version_line/$pattern1/} + versionName=${versionName/$pattern2/} + prBody=${{ github.event.pull_request.body }} + curl -X POST -H 'Content-type: application/json; charset=UTF-8' \ + -H "Authorization: Bearer ${{ secrets.CHECKOUT_SLACK_BOT_TOKEN }}" \ + --data '{ + "channel": "C02GTS30HUN", + "text": "Version update found for Checkout PG Core SDK. Please find the version update details below:\nSDK Variant: React Native Standard Checkout SDK\nNew Version:${versionName}\nChangelog:${prBody}\n cc: " + }' \ + https://slack.com/api/chat.postMessage \ No newline at end of file From 25e13443bc7131da99ead8ca4d4e4477c011c9bd Mon Sep 17 00:00:00 2001 From: Vivek Shindhe Date: Fri, 20 Dec 2024 13:49:18 +0530 Subject: [PATCH 08/16] Update version_update_trigger.yml --- .github/workflows/version_update_trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/version_update_trigger.yml b/.github/workflows/version_update_trigger.yml index 10f53215..b77ea71b 100644 --- a/.github/workflows/version_update_trigger.yml +++ b/.github/workflows/version_update_trigger.yml @@ -34,7 +34,7 @@ jobs: pattern2="\"," versionName=${version_line/$pattern1/} versionName=${versionName/$pattern2/} - prBody=${{ github.event.pull_request.body }} + prBody="${{ github.event.pull_request.body }}" curl -X POST -H 'Content-type: application/json; charset=UTF-8' \ -H "Authorization: Bearer ${{ secrets.CHECKOUT_SLACK_BOT_TOKEN }}" \ --data '{ From 6ff35643fdf2cd0cb96dc0386759a57dc1173589 Mon Sep 17 00:00:00 2001 From: Vivek Shindhe Date: Fri, 20 Dec 2024 14:23:53 +0530 Subject: [PATCH 09/16] Update version_update_trigger.yml --- .github/workflows/version_update_trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/version_update_trigger.yml b/.github/workflows/version_update_trigger.yml index b77ea71b..cfc38481 100644 --- a/.github/workflows/version_update_trigger.yml +++ b/.github/workflows/version_update_trigger.yml @@ -39,6 +39,6 @@ jobs: -H "Authorization: Bearer ${{ secrets.CHECKOUT_SLACK_BOT_TOKEN }}" \ --data '{ "channel": "C02GTS30HUN", - "text": "Version update found for Checkout PG Core SDK. Please find the version update details below:\nSDK Variant: React Native Standard Checkout SDK\nNew Version:${versionName}\nChangelog:${prBody}\n cc: " + "text": "Version update found for Checkout PG Core SDK. Please find the version update details below:\nSDK Variant: React Native Standard Checkout SDK\nNew Version:`${versionName}`\nChangelog:`${prBody}`\ncc: " }' \ https://slack.com/api/chat.postMessage \ No newline at end of file From 13f756ac187e61013df74fffda7e761d6b4a6523 Mon Sep 17 00:00:00 2001 From: Vivek Shindhe Date: Fri, 20 Dec 2024 15:40:00 +0530 Subject: [PATCH 10/16] Update version_update_trigger.yml --- .github/workflows/version_update_trigger.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/version_update_trigger.yml b/.github/workflows/version_update_trigger.yml index cfc38481..fc2a0ecd 100644 --- a/.github/workflows/version_update_trigger.yml +++ b/.github/workflows/version_update_trigger.yml @@ -35,10 +35,10 @@ jobs: versionName=${version_line/$pattern1/} versionName=${versionName/$pattern2/} prBody="${{ github.event.pull_request.body }}" + finalVersionName="${versionName}" + echo "$prBody" + echo "$versionName" curl -X POST -H 'Content-type: application/json; charset=UTF-8' \ -H "Authorization: Bearer ${{ secrets.CHECKOUT_SLACK_BOT_TOKEN }}" \ - --data '{ - "channel": "C02GTS30HUN", - "text": "Version update found for Checkout PG Core SDK. Please find the version update details below:\nSDK Variant: React Native Standard Checkout SDK\nNew Version:`${versionName}`\nChangelog:`${prBody}`\ncc: " - }' \ + --data "{\"channel\":\"C02GTS30HUN\",\"text\":\"Version update found for Checkout PG Core SDK. Please find the version update details below:\\nSDK Variant: React Native Standard Checkout SDK\\nNew Version:${versionName}\\nChangelog:${prBody}\\ncc:\"}" \ https://slack.com/api/chat.postMessage \ No newline at end of file From 843cf90d5483000cc881472f6a23c5b7554b4dbc Mon Sep 17 00:00:00 2001 From: Vivek Shindhe Date: Fri, 20 Dec 2024 16:00:50 +0530 Subject: [PATCH 11/16] Update version_update_trigger.yml --- .github/workflows/version_update_trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/version_update_trigger.yml b/.github/workflows/version_update_trigger.yml index fc2a0ecd..05dd8c16 100644 --- a/.github/workflows/version_update_trigger.yml +++ b/.github/workflows/version_update_trigger.yml @@ -40,5 +40,5 @@ jobs: echo "$versionName" curl -X POST -H 'Content-type: application/json; charset=UTF-8' \ -H "Authorization: Bearer ${{ secrets.CHECKOUT_SLACK_BOT_TOKEN }}" \ - --data "{\"channel\":\"C02GTS30HUN\",\"text\":\"Version update found for Checkout PG Core SDK. Please find the version update details below:\\nSDK Variant: React Native Standard Checkout SDK\\nNew Version:${versionName}\\nChangelog:${prBody}\\ncc:\"}" \ + --data '{\"channel\":\"C02GTS30HUN\",\"text\":\"Version update found for Checkout PG Core SDK. Please find the version update details below:\\nSDK Variant: React Native Standard Checkout SDK\\nNew Version:${versionName}\\nChangelog:${prBody}\\ncc:\"}' \ https://slack.com/api/chat.postMessage \ No newline at end of file From 90c4f9bab13247ea88ae4337445ace1058c5a6c7 Mon Sep 17 00:00:00 2001 From: Vivek Shindhe Date: Fri, 20 Dec 2024 16:04:06 +0530 Subject: [PATCH 12/16] Update version_update_trigger.yml --- .github/workflows/version_update_trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/version_update_trigger.yml b/.github/workflows/version_update_trigger.yml index 05dd8c16..1ff6ca7c 100644 --- a/.github/workflows/version_update_trigger.yml +++ b/.github/workflows/version_update_trigger.yml @@ -40,5 +40,5 @@ jobs: echo "$versionName" curl -X POST -H 'Content-type: application/json; charset=UTF-8' \ -H "Authorization: Bearer ${{ secrets.CHECKOUT_SLACK_BOT_TOKEN }}" \ - --data '{\"channel\":\"C02GTS30HUN\",\"text\":\"Version update found for Checkout PG Core SDK. Please find the version update details below:\\nSDK Variant: React Native Standard Checkout SDK\\nNew Version:${versionName}\\nChangelog:${prBody}\\ncc:\"}' \ + --data '{\"channel\":\"C1GMWKRF1\",\"text\":\"Hey, Found one version update for one of Checkout PG Core SDKs. Please find the version update details below:\\nSDK Variant: React Native Standard Checkout SDK\\nNew Version:${versionName}\\nChangelog:${prBody}\\ncc:\"}' \ https://slack.com/api/chat.postMessage \ No newline at end of file From 0fcf63be862b84741daa64d51c2b62cc9612cea4 Mon Sep 17 00:00:00 2001 From: Vivek Shindhe Date: Mon, 23 Dec 2024 11:57:54 +0530 Subject: [PATCH 13/16] Update version_update_trigger.yml --- .github/workflows/version_update_trigger.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/version_update_trigger.yml b/.github/workflows/version_update_trigger.yml index 1ff6ca7c..78db8143 100644 --- a/.github/workflows/version_update_trigger.yml +++ b/.github/workflows/version_update_trigger.yml @@ -23,9 +23,8 @@ jobs: else echo "file_changed=false" >> $GITHUB_ENV fi - - - name: Post message to Slack - if: env.file_changed == 'true' + - name: Gather necessary data for the Slack notification + id: data_for_notif run: | #get version_line from package.json version_line=$(grep -m 1 "\"version\":" ${GITHUB_WORKSPACE}/package.json) @@ -36,9 +35,15 @@ jobs: versionName=${versionName/$pattern2/} prBody="${{ github.event.pull_request.body }}" finalVersionName="${versionName}" - echo "$prBody" - echo "$versionName" + echo "new_version=$finalVersionName" >> GITHUB_ENV + echo "pr_changelog=$prBody" >> GITHUB_ENV + - name: Post message to Slack + if: env.file_changed == 'true' + run: | curl -X POST -H 'Content-type: application/json; charset=UTF-8' \ -H "Authorization: Bearer ${{ secrets.CHECKOUT_SLACK_BOT_TOKEN }}" \ - --data '{\"channel\":\"C1GMWKRF1\",\"text\":\"Hey, Found one version update for one of Checkout PG Core SDKs. Please find the version update details below:\\nSDK Variant: React Native Standard Checkout SDK\\nNew Version:${versionName}\\nChangelog:${prBody}\\ncc:\"}' \ - https://slack.com/api/chat.postMessage \ No newline at end of file + --data '{ + "channel": "C02GTS30HUN", + "text": "Hey, looks like one of the Checkout PG Core SDKs is being released.\nVariant: React Native Standard Checkout SDK\nVersion: `${{ env.new_version }}`\nChangelog:\n`${{ env.pr_changelog }}`\n cc: " + }' \ + https://slack.com/api/chat.postMessage \ No newline at end of file From d265c17a7f1ab737f55c786f7aa2fc85c0b4f8c9 Mon Sep 17 00:00:00 2001 From: Vivek Shindhe Date: Mon, 23 Dec 2024 12:25:44 +0530 Subject: [PATCH 14/16] Update version_update_trigger.yml --- .github/workflows/version_update_trigger.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/version_update_trigger.yml b/.github/workflows/version_update_trigger.yml index 78db8143..291afe46 100644 --- a/.github/workflows/version_update_trigger.yml +++ b/.github/workflows/version_update_trigger.yml @@ -35,8 +35,8 @@ jobs: versionName=${versionName/$pattern2/} prBody="${{ github.event.pull_request.body }}" finalVersionName="${versionName}" - echo "new_version=$finalVersionName" >> GITHUB_ENV - echo "pr_changelog=$prBody" >> GITHUB_ENV + echo "new_version=$finalVersionName" >> $GITHUB_ENV + echo "pr_changelog=$prBody" >> $GITHUB_ENV - name: Post message to Slack if: env.file_changed == 'true' run: | From a72a85f325f51cb700e9308c509d43a56d6a1f3d Mon Sep 17 00:00:00 2001 From: Vivek Shindhe Date: Mon, 23 Dec 2024 12:31:40 +0530 Subject: [PATCH 15/16] Changed Notification message --- .github/workflows/version_update_trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/version_update_trigger.yml b/.github/workflows/version_update_trigger.yml index 291afe46..c18e4d5a 100644 --- a/.github/workflows/version_update_trigger.yml +++ b/.github/workflows/version_update_trigger.yml @@ -44,6 +44,6 @@ jobs: -H "Authorization: Bearer ${{ secrets.CHECKOUT_SLACK_BOT_TOKEN }}" \ --data '{ "channel": "C02GTS30HUN", - "text": "Hey, looks like one of the Checkout PG Core SDKs is being released.\nVariant: React Native Standard Checkout SDK\nVersion: `${{ env.new_version }}`\nChangelog:\n`${{ env.pr_changelog }}`\n cc: " + "text": "Hey,, looks like one of the Checkout PG Core SDKs will being released. A PR was found here: https://github.com/razorpay/react-native-razorpay/pull/${{ github.event.number }} \nVariant: React Native Standard Checkout SDK\nVersion: `${{ env.new_version }}`\nChangelog:\n`${{ env.pr_changelog }}`\n cc: " }' \ https://slack.com/api/chat.postMessage \ No newline at end of file From a050bbc22dfd148ccbb9ee3851884e5a290ddbcb Mon Sep 17 00:00:00 2001 From: Vivek Shindhe Date: Mon, 23 Dec 2024 12:32:27 +0530 Subject: [PATCH 16/16] updated channel id --- .github/workflows/version_update_trigger.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/version_update_trigger.yml b/.github/workflows/version_update_trigger.yml index c18e4d5a..eb41a674 100644 --- a/.github/workflows/version_update_trigger.yml +++ b/.github/workflows/version_update_trigger.yml @@ -43,7 +43,7 @@ jobs: curl -X POST -H 'Content-type: application/json; charset=UTF-8' \ -H "Authorization: Bearer ${{ secrets.CHECKOUT_SLACK_BOT_TOKEN }}" \ --data '{ - "channel": "C02GTS30HUN", + "channel": "C1GMWKRF1", "text": "Hey,, looks like one of the Checkout PG Core SDKs will being released. A PR was found here: https://github.com/razorpay/react-native-razorpay/pull/${{ github.event.number }} \nVariant: React Native Standard Checkout SDK\nVersion: `${{ env.new_version }}`\nChangelog:\n`${{ env.pr_changelog }}`\n cc: " }' \ https://slack.com/api/chat.postMessage \ No newline at end of file