Browse Source

ref: only report to pytest-sentry in main repository (#41396)

https://getsentry.atlassian.net/browse/DEVINFRA-153
anthony sottile 2 years ago
parent
commit
3015570871
1 changed files with 13 additions and 7 deletions
  1. 13 7
      .github/actions/setup-sentry/action.yml

+ 13 - 7
.github/actions/setup-sentry/action.yml

@@ -69,17 +69,27 @@ runs:
 
         echo "PIP_DISABLE_PIP_VERSION_CHECK=on" >> $GITHUB_ENV
         echo "PIP_INDEX_URL=https://pypi.devinfra.sentry.io/simple" >> $GITHUB_ENV
-        echo "PY_COLORS=1" >> "$GITHUB_ENV"
         echo "SENTRY_SKIP_BACKEND_VALIDATION=1" >> $GITHUB_ENV
 
         ### node configuration ###
         echo "NODE_ENV=development" >> $GITHUB_ENV
         echo "NODE_OPTIONS=--max-old-space-size=4096" >> $GITHUB_ENV
 
-        ### pytest-sentry configuration ###
-        echo "PYTEST_SENTRY_DSN=https://6fd5cfea2d4d46b182ad214ac7810508@sentry.io/2423079" >> $GITHUB_ENV
+        ### pytest configuration ###
+        echo "PY_COLORS=1" >> "$GITHUB_ENV"
         echo "PYTEST_ADDOPTS=--reruns=5 --durations=10" >> $GITHUB_ENV
 
+        ### pytest-sentry configuration ###
+        if [ "$GITHUB_REPOSITORY" = "getsentry/sentry" ]; then
+          echo "PYTEST_SENTRY_DSN=https://6fd5cfea2d4d46b182ad214ac7810508@sentry.io/2423079" >> $GITHUB_ENV
+
+          # This records failures on master to sentry in order to detect flakey tests, as it's
+          # expected that people have failing tests on their PRs
+          if [ "$GITHUB_REF" = "refs/heads/master" ]; then
+            echo "PYTEST_SENTRY_ALWAYS_REPORT=1" >> $GITHUB_ENV
+          fi
+        fi
+
         # Configure a different release version, otherwise it defaults to the
         # commit sha which will conflict with our actual prod releases. This is a
         # confusing experience because it looks like these are "empty" releases
@@ -97,10 +107,6 @@ runs:
           echo "TOTAL_TEST_GROUPS=$MATRIX_INSTANCE_TOTAL" >> $GITHUB_ENV
         fi
 
-        # This records failures on master to sentry in order to detect flakey tests, as it's
-        # expected that people have failing tests on their PRs
-        [ "$GITHUB_REF" = "refs/heads/master" ] && echo "PYTEST_SENTRY_ALWAYS_REPORT=1" >> $GITHUB_ENV || true
-
     - name: Setup python
       uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984  # v4.3.0
       with: