From f1e0ea34d8aa13b1bd363c1cd69d40c1c193eddb Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Mon, 22 Apr 2024 16:26:43 -0400 Subject: [PATCH 01/23] Create telemetry-check.yml --- .github/workflows/telemetry-check.yml | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/telemetry-check.yml diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml new file mode 100644 index 000000000000..ef86f8574fca --- /dev/null +++ b/.github/workflows/telemetry-check.yml @@ -0,0 +1,31 @@ +name: Analytics Telemetry Check + +on: + pull_request: + branches: + - main + +jobs: + check-telemetry: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Check for deprecated telemetry calls + run: | + MATCHES=$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx}") + if [ -n "$MATCHES" ]; then + echo "::error::Deprecated telemetry calls found: $MATCHES" + exit 1 + fi + + check-telemetry-event: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Check for telemetry event with numbers + run: | + MATCHES=$(grep -rn "telemetryRecorder\.recorderEvent\([^)]*\d+[^)]*\)" --include="*.{js,ts,tsx}") + if [ -n "$MATCHES" ]; then + echo "::error::Telemetry events with numbers found: $MATCHES" + exit 1 + fi From 542123ce2aa704b20d0dce75709846311f762cdc Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Mon, 22 Apr 2024 23:22:47 -0400 Subject: [PATCH 02/23] update to use shell:bash --- .github/workflows/telemetry-check.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index ef86f8574fca..71598a5f446a 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -6,11 +6,12 @@ on: - main jobs: - check-telemetry: + v1-telemetry-check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Check for deprecated telemetry calls + shell: bash run: | MATCHES=$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx}") if [ -n "$MATCHES" ]; then @@ -23,6 +24,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Check for telemetry event with numbers + shell: bash run: | MATCHES=$(grep -rn "telemetryRecorder\.recorderEvent\([^)]*\d+[^)]*\)" --include="*.{js,ts,tsx}") if [ -n "$MATCHES" ]; then From d7054904c54c2aea4e3d38aba256ea52d0730c06 Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Mon, 22 Apr 2024 23:32:43 -0400 Subject: [PATCH 03/23] Update telemetry-check.yml --- .github/workflows/telemetry-check.yml | 29 ++++++++++++++------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index 71598a5f446a..3d8e7474476c 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -6,7 +6,7 @@ on: - main jobs: - v1-telemetry-check: + check-for-deprecated-v1-telemetry: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -15,19 +15,20 @@ jobs: run: | MATCHES=$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx}") if [ -n "$MATCHES" ]; then - echo "::error::Deprecated telemetry calls found: $MATCHES" + echo "Deprecated telemetry calls found" + echo "::error::Deprecated telemetry calls found: ${MATCHES}" exit 1 fi - check-telemetry-event: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Check for telemetry event with numbers - shell: bash - run: | - MATCHES=$(grep -rn "telemetryRecorder\.recorderEvent\([^)]*\d+[^)]*\)" --include="*.{js,ts,tsx}") - if [ -n "$MATCHES" ]; then - echo "::error::Telemetry events with numbers found: $MATCHES" - exit 1 - fi + # check-telemetry-event: + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v3 + # - name: Check for telemetry event with numbers + # shell: bash + # run: | + # MATCHES=$(grep -rn "telemetryRecorder\.recorderEvent\([^)]*\d+[^)]*\)" --include="*.{js,ts,tsx}") + # if [ -n "$MATCHES" ]; then + # echo "::error::Telemetry events with numbers found: $MATCHES" + # exit 1 + # fi From e63e90e602795b082c11dd2f5f327682d0b875ba Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Mon, 22 Apr 2024 23:34:42 -0400 Subject: [PATCH 04/23] testing --- .github/workflows/telemetry-check.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index 3d8e7474476c..b7ca96d752df 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -13,7 +13,8 @@ jobs: - name: Check for deprecated telemetry calls shell: bash run: | - MATCHES=$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx}") + MATCHES="$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx}")" + echo "matches: ${MATCHES}" if [ -n "$MATCHES" ]; then echo "Deprecated telemetry calls found" echo "::error::Deprecated telemetry calls found: ${MATCHES}" From aeabac1ab1999da1bd192e871b7caadda97bf546 Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Mon, 22 Apr 2024 23:41:06 -0400 Subject: [PATCH 05/23] testing --- .github/workflows/telemetry-check.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index b7ca96d752df..1b90999842a1 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -13,13 +13,16 @@ jobs: - name: Check for deprecated telemetry calls shell: bash run: | - MATCHES="$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx}")" - echo "matches: ${MATCHES}" - if [ -n "$MATCHES" ]; then - echo "Deprecated telemetry calls found" - echo "::error::Deprecated telemetry calls found: ${MATCHES}" - exit 1 - fi + echo "Checking for deprecated telemetry calls" + + # run: | + # MATCHES="$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx}")" + # echo "matches: ${MATCHES}" + # if [ -n "$MATCHES" ]; then + # echo "Deprecated telemetry calls found" + # echo "::error::Deprecated telemetry calls found: ${MATCHES}" + # exit 1 + # fi # check-telemetry-event: # runs-on: ubuntu-latest From df77d08d02037e0a6525f4e119063fab49c0fdad Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Mon, 22 Apr 2024 23:43:08 -0400 Subject: [PATCH 06/23] testing --- .github/workflows/telemetry-check.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index 1b90999842a1..ac971190018a 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -14,6 +14,8 @@ jobs: shell: bash run: | echo "Checking for deprecated telemetry calls" + matches="$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx}")" + echo "matches: ${matches}" # run: | # MATCHES="$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx}")" From 69ea57ec5306b3028b3821d6833faf21c9e63950 Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Mon, 22 Apr 2024 23:44:04 -0400 Subject: [PATCH 07/23] testing --- .github/workflows/telemetry-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index ac971190018a..0a054ff2028d 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -14,7 +14,7 @@ jobs: shell: bash run: | echo "Checking for deprecated telemetry calls" - matches="$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx}")" + matches=$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx}") echo "matches: ${matches}" # run: | From 57952887eadb4259eb9a96ee60df2f1ef19a005a Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Mon, 22 Apr 2024 23:46:11 -0400 Subject: [PATCH 08/23] testing --- .github/workflows/telemetry-check.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index 0a054ff2028d..77c13b892197 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -14,7 +14,8 @@ jobs: shell: bash run: | echo "Checking for deprecated telemetry calls" - matches=$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx}") + set -e + matches=$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx}" || true) echo "matches: ${matches}" # run: | From cee32984142540113004e8cbdc8713165e733d5e Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Mon, 22 Apr 2024 23:48:10 -0400 Subject: [PATCH 09/23] testing --- .github/workflows/telemetry-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index 77c13b892197..ead1f505ad5d 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -15,7 +15,7 @@ jobs: run: | echo "Checking for deprecated telemetry calls" set -e - matches=$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx}" || true) + matches=$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx,yml}" || true) echo "matches: ${matches}" # run: | From f21e8ed0b9a6528fbeacf702c6bbf7a3d6e31c80 Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Mon, 22 Apr 2024 23:49:40 -0400 Subject: [PATCH 10/23] Update telemetry-check.yml --- .github/workflows/telemetry-check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index ead1f505ad5d..e828cdc0ed1e 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -16,6 +16,7 @@ jobs: echo "Checking for deprecated telemetry calls" set -e matches=$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx,yml}" || true) + echo "logEvent('this should get flagged')" echo "matches: ${matches}" # run: | From ca7f1b00086a8280eaed7ba4f7d3a032d1fabada Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Mon, 22 Apr 2024 23:52:05 -0400 Subject: [PATCH 11/23] Update telemetry-check.yml --- .github/workflows/telemetry-check.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index e828cdc0ed1e..5ec551780ce3 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -14,8 +14,7 @@ jobs: shell: bash run: | echo "Checking for deprecated telemetry calls" - set -e - matches=$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx,yml}" || true) + matches=$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx,yml}") echo "logEvent('this should get flagged')" echo "matches: ${matches}" From 0113d099157f971016b32b64d4c3432841971b9b Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Mon, 22 Apr 2024 23:58:23 -0400 Subject: [PATCH 12/23] Update telemetry-check.yml --- .github/workflows/telemetry-check.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index 5ec551780ce3..2ea587ce0818 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -14,9 +14,19 @@ jobs: shell: bash run: | echo "Checking for deprecated telemetry calls" - matches=$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx,yml}") echo "logEvent('this should get flagged')" - echo "matches: ${matches}" + if grep -rqE 'logEvent|logEvents|eventLogger\.log' .; then + echo "Found log events in modified files." + exit 1 + else + echo "No log events found in modified files." + exit 0 + fi + + # echo "Checking for deprecated telemetry calls" + # matches=$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx,yml}") + # echo "logEvent('this should get flagged')" + # echo "matches: ${matches}" # run: | # MATCHES="$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx}")" From e27d8c84209f000082e20bc21e0675b37780a60e Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Tue, 23 Apr 2024 00:00:57 -0400 Subject: [PATCH 13/23] Update telemetry-check.yml --- .github/workflows/telemetry-check.yml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index 2ea587ce0818..f21d6b562978 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -15,14 +15,29 @@ jobs: run: | echo "Checking for deprecated telemetry calls" echo "logEvent('this should get flagged')" - if grep -rqE 'logEvent|logEvents|eventLogger\.log' .; then - echo "Found log events in modified files." - exit 1 + + if grep -rEn 'logEvent|logEvents|eventLogger\.log' .; then + echo "Found log events in the following files:" + grep -rEn 'logEvent|logEvents|eventLogger\.log' . | while read -r line ; do + file=$(echo "$line" | cut -d':' -f1) + match=$(echo "$line" | cut -d':' -f2-) + echo "File: $file, Match: $match" + done + exit 1 else echo "No log events found in modified files." exit 0 fi + + # if grep -rqE 'logEvent|logEvents|eventLogger\.log' .; then + # echo "Found log events in modified files." + # exit 1 + # else + # echo "No log events found in modified files." + # exit 0 + # fi + # echo "Checking for deprecated telemetry calls" # matches=$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx,yml}") # echo "logEvent('this should get flagged')" From 4c0922682eca735e22cf06978b236d37051d38a8 Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Tue, 23 Apr 2024 00:06:30 -0400 Subject: [PATCH 14/23] Update telemetry-check.yml --- .github/workflows/telemetry-check.yml | 63 ++++++++------------------- 1 file changed, 17 insertions(+), 46 deletions(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index f21d6b562978..43162245720f 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -11,56 +11,27 @@ jobs: steps: - uses: actions/checkout@v3 - name: Check for deprecated telemetry calls + shell: bash run: | echo "Checking for deprecated telemetry calls" echo "logEvent('this should get flagged')" - - if grep -rEn 'logEvent|logEvents|eventLogger\.log' .; then - echo "Found log events in the following files:" - grep -rEn 'logEvent|logEvents|eventLogger\.log' . | while read -r line ; do - file=$(echo "$line" | cut -d':' -f1) - match=$(echo "$line" | cut -d':' -f2-) - echo "File: $file, Match: $match" - done - exit 1 + files_modified=$(git diff --name-only ${{ github.base_ref }} ${{ github.head_ref }}) + if [ -n "$files_modified" ]; then + echo "Modified files found: $files_modified" + if echo "$files_modified" | xargs grep -rnE 'logEvent|logEvents|eventLogger\.log'; then + echo "Found log events in the following files:" + echo "$files_modified" | xargs grep -rEn 'logEvent|logEvents|eventLogger\.log' | while read -r line ; do + file=$(echo "$line" | cut -d':' -f1) + match=$(echo "$line" | cut -d':' -f2-) + echo "File: $file, Match: $match" + done + exit 1 + else + echo "No log events found in modified files." + exit 0 + fi else - echo "No log events found in modified files." + echo "No modified files found." exit 0 fi - - - # if grep -rqE 'logEvent|logEvents|eventLogger\.log' .; then - # echo "Found log events in modified files." - # exit 1 - # else - # echo "No log events found in modified files." - # exit 0 - # fi - - # echo "Checking for deprecated telemetry calls" - # matches=$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx,yml}") - # echo "logEvent('this should get flagged')" - # echo "matches: ${matches}" - - # run: | - # MATCHES="$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx}")" - # echo "matches: ${MATCHES}" - # if [ -n "$MATCHES" ]; then - # echo "Deprecated telemetry calls found" - # echo "::error::Deprecated telemetry calls found: ${MATCHES}" - # exit 1 - # fi - - # check-telemetry-event: - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - name: Check for telemetry event with numbers - # shell: bash - # run: | - # MATCHES=$(grep -rn "telemetryRecorder\.recorderEvent\([^)]*\d+[^)]*\)" --include="*.{js,ts,tsx}") - # if [ -n "$MATCHES" ]; then - # echo "::error::Telemetry events with numbers found: $MATCHES" - # exit 1 - # fi From 330d5392dd9e78876cb7a056f09c7dd9fa8ad612 Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Tue, 23 Apr 2024 00:16:18 -0400 Subject: [PATCH 15/23] Update telemetry-check.yml --- .github/workflows/telemetry-check.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index 43162245720f..34e39cf74892 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -16,7 +16,8 @@ jobs: run: | echo "Checking for deprecated telemetry calls" echo "logEvent('this should get flagged')" - files_modified=$(git diff --name-only ${{ github.base_ref }} ${{ github.head_ref }}) + cd ${{ github.workspace }} + files_modified=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}) if [ -n "$files_modified" ]; then echo "Modified files found: $files_modified" if echo "$files_modified" | xargs grep -rnE 'logEvent|logEvents|eventLogger\.log'; then From 432d29dc1d53369f4c5d001702ad336b1b0ac4cd Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Tue, 23 Apr 2024 00:18:42 -0400 Subject: [PATCH 16/23] Update telemetry-check.yml --- .github/workflows/telemetry-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index 34e39cf74892..1bb4a8eb6b7a 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -17,7 +17,7 @@ jobs: echo "Checking for deprecated telemetry calls" echo "logEvent('this should get flagged')" cd ${{ github.workspace }} - files_modified=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}) + files_modified=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) if [ -n "$files_modified" ]; then echo "Modified files found: $files_modified" if echo "$files_modified" | xargs grep -rnE 'logEvent|logEvents|eventLogger\.log'; then From 7b646670fb33f2b4c1fabb6bc7a2ba13dc4ef6d9 Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Tue, 23 Apr 2024 00:29:45 -0400 Subject: [PATCH 17/23] Update telemetry-check.yml --- .github/workflows/telemetry-check.yml | 28 ++++++++++++--------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index 1bb4a8eb6b7a..32c043a89b0b 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -11,28 +11,24 @@ jobs: steps: - uses: actions/checkout@v3 - name: Check for deprecated telemetry calls - + if: github.event_name == 'pull_request' shell: bash run: | echo "Checking for deprecated telemetry calls" - echo "logEvent('this should get flagged')" - cd ${{ github.workspace }} - files_modified=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) - if [ -n "$files_modified" ]; then - echo "Modified files found: $files_modified" - if echo "$files_modified" | xargs grep -rnE 'logEvent|logEvents|eventLogger\.log'; then + modified_files=$(git diff --name-only origin/main...HEAD) + echo "Modified files: $modified_files" + if echo "$modified_files" | grep -qE 'logEvent|logEvents|eventLogger\.log'; then echo "Found log events in the following files:" - echo "$files_modified" | xargs grep -rEn 'logEvent|logEvents|eventLogger\.log' | while read -r line ; do - file=$(echo "$line" | cut -d':' -f1) - match=$(echo "$line" | cut -d':' -f2-) - echo "File: $file, Match: $match" + echo "$modified_files" | grep -E 'logEvent|logEvents|eventLogger\.log' | while read -r file ; do + echo "File: $file" + grep -En 'logEvent|logEvents|eventLogger\.log' "$file" | while read -r line ; do + line_number=$(echo "$line" | cut -d':' -f1) + matched_text=$(echo "$line" | cut -d':' -f2-) + echo " Line $line_number: $matched_text" + done done exit 1 - else + else echo "No log events found in modified files." exit 0 - fi - else - echo "No modified files found." - exit 0 fi From 8101d85f1b64e48599d35fac47127733d4450f30 Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Tue, 23 Apr 2024 00:30:59 -0400 Subject: [PATCH 18/23] Update telemetry-check.yml --- .github/workflows/telemetry-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index 32c043a89b0b..ae9d96730064 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -15,7 +15,7 @@ jobs: shell: bash run: | echo "Checking for deprecated telemetry calls" - modified_files=$(git diff --name-only origin/main...HEAD) + modified_files=$(git diff --name-only main...HEAD) echo "Modified files: $modified_files" if echo "$modified_files" | grep -qE 'logEvent|logEvents|eventLogger\.log'; then echo "Found log events in the following files:" From b55d5514aefbd1845e6d31549ea0b947d5166c80 Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Tue, 23 Apr 2024 00:38:01 -0400 Subject: [PATCH 19/23] Update telemetry-check.yml --- .github/workflows/telemetry-check.yml | 29 +++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index ae9d96730064..44b64982831c 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -9,17 +9,34 @@ jobs: check-for-deprecated-v1-telemetry: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }} + + - name: Get changed files + id: changed-files + run: | + if [[ "${{ github.event_name }}" == 'pull_request' ]]; then + echo "changed_files=$(git diff --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_ENV + else + echo "changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_ENV + fi + + - name: List changed files + run: | + for file in ${{ env.changed_files }}; do + echo "$file was changed" + done + - name: Check for deprecated telemetry calls - if: github.event_name == 'pull_request' + if: success() shell: bash run: | echo "Checking for deprecated telemetry calls" - modified_files=$(git diff --name-only main...HEAD) - echo "Modified files: $modified_files" - if echo "$modified_files" | grep -qE 'logEvent|logEvents|eventLogger\.log'; then + if echo "${{ env.changed_files }}" | grep -qE 'logEvent|logEvents|eventLogger\.log'; then echo "Found log events in the following files:" - echo "$modified_files" | grep -E 'logEvent|logEvents|eventLogger\.log' | while read -r file ; do + echo "${{ env.changed_files }}" | grep -E 'logEvent|logEvents|eventLogger\.log' | while read -r file ; do echo "File: $file" grep -En 'logEvent|logEvents|eventLogger\.log' "$file" | while read -r line ; do line_number=$(echo "$line" | cut -d':' -f1) From f55324aab7165ef72cba4cfc33e76937f9d46e50 Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Tue, 23 Apr 2024 00:40:30 -0400 Subject: [PATCH 20/23] Update telemetry-check.yml --- .github/workflows/telemetry-check.yml | 44 +++++++-------------------- 1 file changed, 11 insertions(+), 33 deletions(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index 44b64982831c..ee1f626f3099 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -9,43 +9,21 @@ jobs: check-for-deprecated-v1-telemetry: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }} - - - name: Get changed files - id: changed-files - run: | - if [[ "${{ github.event_name }}" == 'pull_request' ]]; then - echo "changed_files=$(git diff --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_ENV - else - echo "changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_ENV - fi - - - name: List changed files - run: | - for file in ${{ env.changed_files }}; do - echo "$file was changed" - done - + - uses: actions/checkout@v3 - name: Check for deprecated telemetry calls - if: success() + shell: bash run: | echo "Checking for deprecated telemetry calls" - if echo "${{ env.changed_files }}" | grep -qE 'logEvent|logEvents|eventLogger\.log'; then + echo "logEvent('this should get flagged')" + if grep -rEn 'logEvent|logEvents|eventLogger\.log' .; then echo "Found log events in the following files:" - echo "${{ env.changed_files }}" | grep -E 'logEvent|logEvents|eventLogger\.log' | while read -r file ; do - echo "File: $file" - grep -En 'logEvent|logEvents|eventLogger\.log' "$file" | while read -r line ; do - line_number=$(echo "$line" | cut -d':' -f1) - matched_text=$(echo "$line" | cut -d':' -f2-) - echo " Line $line_number: $matched_text" - done - done - exit 1 + grep -rEn 'logEvent|logEvents|eventLogger\.log' . | while read -r line ; do + file=$(echo "$line" | cut -d':' -f1) match=$(echo "$line" | cut -d':' -f2-) + echo "File: $file, Match: $match" + done + exit 1 else - echo "No log events found in modified files." - exit 0 + echo "No log events found in modified files." + exit 0 fi From 3e06f465c8607fbe0fda5552476276f02f504618 Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Tue, 23 Apr 2024 00:51:09 -0400 Subject: [PATCH 21/23] Squashed commit of the following: commit f55324aab7165ef72cba4cfc33e76937f9d46e50 Author: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Tue Apr 23 00:40:30 2024 -0400 Update telemetry-check.yml commit b55d5514aefbd1845e6d31549ea0b947d5166c80 Author: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Tue Apr 23 00:38:01 2024 -0400 Update telemetry-check.yml commit 8101d85f1b64e48599d35fac47127733d4450f30 Author: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Tue Apr 23 00:30:59 2024 -0400 Update telemetry-check.yml commit 7b646670fb33f2b4c1fabb6bc7a2ba13dc4ef6d9 Author: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Tue Apr 23 00:29:45 2024 -0400 Update telemetry-check.yml commit 432d29dc1d53369f4c5d001702ad336b1b0ac4cd Author: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Tue Apr 23 00:18:42 2024 -0400 Update telemetry-check.yml commit 330d5392dd9e78876cb7a056f09c7dd9fa8ad612 Author: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Tue Apr 23 00:16:18 2024 -0400 Update telemetry-check.yml commit 4c0922682eca735e22cf06978b236d37051d38a8 Author: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Tue Apr 23 00:06:30 2024 -0400 Update telemetry-check.yml commit e27d8c84209f000082e20bc21e0675b37780a60e Author: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Tue Apr 23 00:00:57 2024 -0400 Update telemetry-check.yml commit 0113d099157f971016b32b64d4c3432841971b9b Author: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Mon Apr 22 23:58:23 2024 -0400 Update telemetry-check.yml commit ca7f1b00086a8280eaed7ba4f7d3a032d1fabada Author: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Mon Apr 22 23:52:05 2024 -0400 Update telemetry-check.yml commit f21e8ed0b9a6528fbeacf702c6bbf7a3d6e31c80 Author: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Mon Apr 22 23:49:40 2024 -0400 Update telemetry-check.yml commit cee32984142540113004e8cbdc8713165e733d5e Author: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Mon Apr 22 23:48:10 2024 -0400 testing git squash --- .github/workflows/telemetry-check.yml | 38 +++++++++------------------ 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index 77c13b892197..ee1f626f3099 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -11,31 +11,19 @@ jobs: steps: - uses: actions/checkout@v3 - name: Check for deprecated telemetry calls + shell: bash run: | echo "Checking for deprecated telemetry calls" - set -e - matches=$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx}" || true) - echo "matches: ${matches}" - - # run: | - # MATCHES="$(grep -rn "logEvent\|telemetryService.log\|logEvents\|eventLogger\.log" --include="*.{js,ts,tsx}")" - # echo "matches: ${MATCHES}" - # if [ -n "$MATCHES" ]; then - # echo "Deprecated telemetry calls found" - # echo "::error::Deprecated telemetry calls found: ${MATCHES}" - # exit 1 - # fi - - # check-telemetry-event: - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - name: Check for telemetry event with numbers - # shell: bash - # run: | - # MATCHES=$(grep -rn "telemetryRecorder\.recorderEvent\([^)]*\d+[^)]*\)" --include="*.{js,ts,tsx}") - # if [ -n "$MATCHES" ]; then - # echo "::error::Telemetry events with numbers found: $MATCHES" - # exit 1 - # fi + echo "logEvent('this should get flagged')" + if grep -rEn 'logEvent|logEvents|eventLogger\.log' .; then + echo "Found log events in the following files:" + grep -rEn 'logEvent|logEvents|eventLogger\.log' . | while read -r line ; do + file=$(echo "$line" | cut -d':' -f1) match=$(echo "$line" | cut -d':' -f2-) + echo "File: $file, Match: $match" + done + exit 1 + else + echo "No log events found in modified files." + exit 0 + fi From 19881842d2d442cffa1e58fdc18b706ea10b93f1 Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Tue, 23 Apr 2024 10:44:33 -0400 Subject: [PATCH 22/23] only get modified files in the PR --- .github/workflows/telemetry-check.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index ee1f626f3099..ea438b06f437 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -11,15 +11,19 @@ jobs: steps: - uses: actions/checkout@v3 - name: Check for deprecated telemetry calls - shell: bash run: | echo "Checking for deprecated telemetry calls" echo "logEvent('this should get flagged')" - if grep -rEn 'logEvent|logEvents|eventLogger\.log' .; then + + # Get the list of modified files + files=$(git diff --name-only HEAD^ HEAD) + + if grep -rEn 'logEvent|logEvents|eventLogger\.log' $files; then echo "Found log events in the following files:" - grep -rEn 'logEvent|logEvents|eventLogger\.log' . | while read -r line ; do - file=$(echo "$line" | cut -d':' -f1) match=$(echo "$line" | cut -d':' -f2-) + grep -rEn 'logEvent|logEvents|eventLogger\.log' $files | while read -r line ; do + file=$(echo "$line" | cut -d':' -f1) + match=$(echo "$line" | cut -d':' -f2-) echo "File: $file, Match: $match" done exit 1 From 3e23d4a29cb55153bd23f965bb5b942a9c4cdfbf Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Tue, 23 Apr 2024 10:54:16 -0400 Subject: [PATCH 23/23] Update telemetry-check.yml --- .github/workflows/telemetry-check.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index ea438b06f437..e17e27497f56 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -10,23 +10,26 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v35 + - name: Check for deprecated telemetry calls shell: bash run: | echo "Checking for deprecated telemetry calls" echo "logEvent('this should get flagged')" + echo "ChangedFiles: ${{steps.changed-files.outputs.files}}" - # Get the list of modified files - files=$(git diff --name-only HEAD^ HEAD) - - if grep -rEn 'logEvent|logEvents|eventLogger\.log' $files; then + if grep -rEn 'logEvent|logEvents|eventLogger\.log' "${{ steps.changed-files.outputs.files }}"; then echo "Found log events in the following files:" - grep -rEn 'logEvent|logEvents|eventLogger\.log' $files | while read -r line ; do - file=$(echo "$line" | cut -d':' -f1) - match=$(echo "$line" | cut -d':' -f2-) - echo "File: $file, Match: $match" - done - exit 1 + grep -rEn 'logEvent|logEvents|eventLogger\.log' "${{ steps.changed-files.outputs.files }}" | while read -r line ; do + file=$(echo "$line" | cut -d':' -f1) + match=$(echo "$line" | cut -d':' -f2-) + echo "File: $file, Match: $match" + done + exit 1 else echo "No log events found in modified files." exit 0