From 2ce34ccf96f05688286e2ac0d1806e1dbf524dcf Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Tue, 23 Apr 2024 11:50:29 -0400 Subject: [PATCH 1/2] Create telemetry-check.yml --- .github/workflows/telemetry-check.yml | 30 +++++++++++++++++++++++++++ 1 file changed, 30 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 00000000000..887c916c10a --- /dev/null +++ b/.github/workflows/telemetry-check.yml @@ -0,0 +1,30 @@ +name: Analytics Telemetry Check + +on: + pull_request: + branches: + - main + +jobs: + check-for-deprecated-v1-telemetry: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Check for deprecated telemetry calls + shell: bash + run: | + echo "Checking for deprecated telemetry calls" + # ToDo: test below before pushing + 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 ccd6fafcc89ddf28219d7dc0f1127e1bac97bfc2 Mon Sep 17 00:00:00 2001 From: Aditya Kalia <32119652+akalia25@users.noreply.github.com> Date: Wed, 24 Apr 2024 11:49:22 -0400 Subject: [PATCH 2/2] fix formatting --- .github/workflows/telemetry-check.yml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/telemetry-check.yml b/.github/workflows/telemetry-check.yml index 887c916c10a..b990f21b672 100644 --- a/.github/workflows/telemetry-check.yml +++ b/.github/workflows/telemetry-check.yml @@ -8,23 +8,38 @@ on: jobs: check-for-deprecated-v1-telemetry: runs-on: ubuntu-latest + steps: - uses: actions/checkout@v3 - name: Check for deprecated telemetry calls shell: bash run: | + echo "Checking for deprecated telemetry calls" + # ToDo: test below before pushing 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 "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 + + done + + exit 1 + else + echo "No log events found in modified files." exit 0 + fi