Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/sentry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
cache: gradle
- name: Get version from Gradle
id: get_version
run: echo "RELEASE_VERSION=$(./gradlew version --console plain -q)" >> $GITHUB_ENV
run: echo "RELEASE_VERSION=$(./gradlew version -q --console plain --no-daemon --warning-mode none 2>/dev/null | tail -1)" >> $GITHUB_ENV
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Add error handling for Gradle version extraction.

The command suppresses all stderr (2>/dev/null) and pipes to tail -1, which silently masks failures. If ./gradlew version fails or produces no output, RELEASE_VERSION will be set to an empty string, causing downstream steps to fail in confusing ways without clear error messages.

Consider:

  1. Checking if the command succeeded before proceeding
  2. Validating that RELEASE_VERSION is non-empty and in the expected format
  3. Using more targeted stderr filtering (if suppression is necessary) rather than discarding all diagnostics

Apply this diff to add basic error handling:

-        run: echo "RELEASE_VERSION=$(./gradlew version -q --console plain --no-daemon --warning-mode none 2>/dev/null | tail -1)" >> $GITHUB_ENV
+        run: |
+          VERSION=$(./gradlew version -q --console plain --no-daemon --warning-mode none 2>&1 | tail -1)
+          if [ -z "$VERSION" ]; then
+            echo "ERROR: Failed to retrieve version from Gradle" >&2
+            exit 1
+          fi
+          echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV

Alternatively, if the full stderr is intentionally suppressed to hide build warnings, add a comment explaining why, and consider logging the extracted version for debugging.



---

🏁 Script executed:

```shell
#!/bin/bash
# Examine the sentry workflow file around line 27
fd -name "sentry.yml" -path "*/.github/workflows/*" --exec cat {} \;

Length of output: 230


🏁 Script executed:

#!/bin/bash
# Search for RELEASE_VERSION usage in workflows
rg -n "RELEASE_VERSION" .github/workflows/ -A 2 -B 2

Length of output: 1399


🏁 Script executed:

#!/bin/bash
# Check for error handling patterns in GitHub Actions workflows
rg -n "set -e|exit 1|\$\?||| exit" .github/workflows/ --type yaml

Length of output: 48481


Add error handling for Gradle version extraction to prevent silent failures.

The command suppresses all stderr (2>/dev/null) and pipes to tail -1, which silently masks failures. If ./gradlew version fails or produces no output, RELEASE_VERSION will be set to an empty string. This causes the subsequent conditionals (lines 31–35) to fail matching, silently defaulting to ENVIRONMENT=feature (line 38), and the Sentry release action to receive an invalid version.

Apply this diff to add validation:

-        run: echo "RELEASE_VERSION=$(./gradlew version -q --console plain --no-daemon --warning-mode none 2>/dev/null | tail -1)" >> $GITHUB_ENV
+        run: |
+          VERSION=$(./gradlew version -q --console plain --no-daemon --warning-mode none 2>&1 | tail -1)
+          if [ -z "$VERSION" ]; then
+            echo "ERROR: Failed to retrieve version from Gradle" >&2
+            exit 1
+          fi
+          echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
🤖 Prompt for AI Agents
.github/workflows/sentry.yml around line 27: the current command hides all
stderr and can produce an empty RELEASE_VERSION silently; change it to capture
both stdout and stderr (don’t redirect stderr to /dev/null), assign the command
output to a variable, trim and validate that it is non-empty and matches the
expected version pattern, and if validation fails print an error to
stdout/stderr and exit non‑zero so the workflow fails early; alternatively, set
a clear fallback and log a warning before exiting to avoid passing an invalid
empty RELEASE_VERSION to the Sentry action.

- name: Get Sentry environment from project version
id: get_env
run: |
Expand Down
Loading