From cb4221938b754bb2ec51f460f3cd0ee859f4be44 Mon Sep 17 00:00:00 2001 From: Arpit Mohan Date: Wed, 7 Oct 2020 06:45:17 +0530 Subject: [PATCH 1/2] Correcting the CI flow to include conditional steps for pull_request_target and push events This is because the pull_request_target runs on the base branch and NOT the merged commit. On the CI, this gives us incorrect results. --- .github/workflows/client.yml | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/.github/workflows/client.yml b/.github/workflows/client.yml index aa320ac996..cf91382238 100644 --- a/.github/workflows/client.yml +++ b/.github/workflows/client.yml @@ -24,10 +24,16 @@ jobs: steps: # Checkout the code - - uses: actions/checkout@v2 + - name: Checkout the merged commit from PR and base branch + if: ${{ github.event_name == 'pull_request_target' }} + uses: actions/checkout@v2 with: ref: refs/pull/${{ github.event.pull_request.number }}/merge + - name: Checkout the head commit of the branch + if: ${{ github.event_name == 'push' }} + uses: actions/checkout@v2 + - name: Figure out the PR number run: echo ${{ github.event.pull_request.number }} @@ -103,7 +109,15 @@ jobs: steps: # Checkout the code - - uses: actions/checkout@v2 + - name: Checkout the merged commit from PR and base branch + if: ${{ github.event_name == 'pull_request_target' }} + uses: actions/checkout@v2 + with: + ref: refs/pull/${{ github.event.pull_request.number }}/merge + + - name: Checkout the head commit of the branch + if: ${{ github.event_name == 'push' }} + uses: actions/checkout@v2 - name: Use Node.js 10.16.3 uses: actions/setup-node@v1 @@ -206,7 +220,15 @@ jobs: steps: # Checkout the code - - uses: actions/checkout@v2 + - name: Checkout the merged commit from PR and base branch + if: ${{ github.event_name == 'pull_request_target' }} + uses: actions/checkout@v2 + with: + ref: refs/pull/${{ github.event.pull_request.number }}/merge + + - name: Checkout the head commit of the branch + if: ${{ github.event_name == 'push' }} + uses: actions/checkout@v2 - name: Download the react build artifact uses: actions/download-artifact@v2 From 3ced89e58cbe4f6a127c84eec346f6c1dece7d2a Mon Sep 17 00:00:00 2001 From: Nikhil Nandagopal Date: Wed, 7 Oct 2020 16:49:56 +0530 Subject: [PATCH 2/2] added applications page load --- app/client/src/pages/Applications/loader.tsx | 2 ++ app/client/src/utils/AnalyticsUtil.tsx | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/client/src/pages/Applications/loader.tsx b/app/client/src/pages/Applications/loader.tsx index 4cac95fe6a..b107b92bd0 100644 --- a/app/client/src/pages/Applications/loader.tsx +++ b/app/client/src/pages/Applications/loader.tsx @@ -4,6 +4,7 @@ import { retryPromise } from "utils/AppsmithUtils"; import PerformanceTracker, { PerformanceTransactionName, } from "utils/PerformanceTracker"; +import AnalyticsUtil from "utils/AnalyticsUtil"; class ApplicationListLoader extends React.PureComponent { constructor(props: any) { @@ -17,6 +18,7 @@ class ApplicationListLoader extends React.PureComponent { componentDidMount() { PerformanceTracker.stopTracking(PerformanceTransactionName.SIGN_UP); PerformanceTracker.stopTracking(PerformanceTransactionName.LOGIN_CLICK); + AnalyticsUtil.logEvent("APPLICATIONS_PAGE_LOAD"); retryPromise(() => import(/* webpackChunkName: "applications" */ "./index"), ).then(module => { diff --git a/app/client/src/utils/AnalyticsUtil.tsx b/app/client/src/utils/AnalyticsUtil.tsx index a90c0e1a84..3055933ce1 100644 --- a/app/client/src/utils/AnalyticsUtil.tsx +++ b/app/client/src/utils/AnalyticsUtil.tsx @@ -83,6 +83,7 @@ export type EventName = | "OPEN_HELP" | "INVITE_USER" | "PROPERTY_PANE_CLOSE_CLICK" + | "APPLICATIONS_PAGE_LOAD" | "EXECUTE_ACTION"; function getApplicationId(location: Location) { @@ -161,7 +162,7 @@ class AnalyticsUtil { })(window); } - static logEvent(eventName: EventName, eventData: any) { + static logEvent(eventName: EventName, eventData: any = {}) { const windowDoc: any = window; let finalEventData = eventData; const userData = AnalyticsUtil.user;