Skip to content
Merged
Changes from 2 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
6 changes: 6 additions & 0 deletions .github/workflows/ci-test-limited.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ jobs:
ports:
# Opens tcp port 6379 on the host and service container
- 6379:6379
postgres:
if: github.base_ref == 'pg' || github.ref_name == 'pg'
image: postgres:14
ports:
- 5432:5432
Comment on lines +51 to +55

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add PostgreSQL environment variables and restrict branch conditions

The PostgreSQL service configuration needs attention in two areas:

  1. Missing essential environment variables (POSTGRES_USER, POSTGRES_PASSWORD)
  2. Branch name condition might unintentionally trigger for branches containing 'pg'

Apply this diff to enhance the configuration:

 postgres:
   if: contains(github.base_ref, 'pg') || github.ref_name == 'pg'
   image: postgres:14
+  env:
+    POSTGRES_USER: postgres
+    POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
   ports:
     - 5432:5432

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 actionlint

52-52: unexpected key "if" for "services" section. expected one of "credentials", "env", "image", "options", "ports", "volumes"

(syntax-check)

Comment thread
AnaghHegde marked this conversation as resolved.
mongo:
if: "!contains(github.base_ref, 'pg') && github.ref_name != 'pg'"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix invalid service-level condition syntax

GitHub Actions doesn't support conditional service execution using the if key. Consider using environment variables or job-level conditions instead.

Consider this alternative approach:

-      mongo:
-        if: "!contains(github.base_ref, 'pg') && github.ref_name != 'pg'"
-        image: mongo
-        ports:
-          - 27017:27017
+      mongo:
+        image: mongo
+        ports:
+          - 27017:27017

Then control the database selection through environment variables in the application configuration.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if: "!contains(github.base_ref, 'pg') && github.ref_name != 'pg'"
mongo:
image: mongo
ports:
- 27017:27017
🧰 Tools
🪛 actionlint

57-57: unexpected key "if" for "services" section. expected one of "credentials", "env", "image", "options", "ports", "volumes"

(syntax-check)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@AnaghHegde can we remove the contains here as well?

image: mongo
ports:
- 27017:27017
Expand Down