Skip to content

Add GitHub Action test for data analytics telemetry monitoring #15

Add GitHub Action test for data analytics telemetry monitoring

Add GitHub Action test for data analytics telemetry monitoring #15

Workflow file for this run

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"
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 }})
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 modified files found."
exit 0
fi