Skip to content

Conversation

@0xced
Copy link
Contributor

@0xced 0xced commented Oct 23, 2025

What does this PR do?

Run the continuous delivery job only from the testcontainers/testcontainers-dotnet repository.

The secrets required for the cd job to run successfully won't be configured in the forks anyway.

Why is it important?

The continuous delivery job has no reason to be run from forks. It will just end up with errors.

Related issues

N/A

@netlify
Copy link

netlify bot commented Oct 23, 2025

Deploy Preview for testcontainers-dotnet ready!

Name Link
🔨 Latest commit 293d43f
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-dotnet/deploys/68fa60a0ea0b6d00080106ef
😎 Deploy Preview https://deploy-preview-1559--testcontainers-dotnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link

coderabbitai bot commented Oct 23, 2025

Summary by CodeRabbit

  • Chores
    • Updated CI/CD workflow to enforce stricter repository and branch validation before execution
    • Reorganized solution project structure for better workflow file management

Walkthrough

Require the CI/CD workflow to run only when both the repository matches testcontainers/testcontainers-dotnet and the branch is develop or main, and add a new Solution Items project "workflows" containing three GitHub Actions workflow files to the Visual Studio solution.

Changes

Cohort / File(s) Summary
CI/CD Workflow
.github/workflows/cicd.yml
Reworked the CD job condition to require both repository equality (testcontainers/testcontainers-dotnet) and branch membership ("develop", "main") before executing the deployment job.
Solution Items / Workflows
Testcontainers.sln, \.github/workflows/...
Added a new solution-level project named workflows (Solution Items) and included three GitHub Actions workflow files (.github/workflows/cicd.yml, codeql-analysis.yml, test-report.yml); updated GlobalSection(NestedProjects) to nest the new project under Solution Items.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer (push/pr)
    participant GH as GitHub
    participant WF as cicd.yml (workflow)

    Dev->>GH: push / open PR
    GH->>WF: evaluate workflow triggers
    note right of WF #DDEBF7: Condition: repo == "testcontainers/testcontainers-dotnet"\nand branch in ["develop","main"]
    alt Condition met
        WF->>WF: run deployment jobs
        WF-->GH: report success/failure
    else Condition not met
        WF-->GH: skip deployment (no job run)
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped through commits with a careful twitch,
Repo and branch now guard the deployment switch.
Workflows nested snug in the solution's den,
A tidy burrow for CI — hop again, my friend! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "chore: Make the continuous delivery job fork-friendly" accurately summarizes the main change in the pull request. It is concise and specific, clearly communicating that the PR addresses making the CD job compatible with forks by restricting its execution to the main repository. The title directly aligns with the changes shown in the raw summary, where the CD workflow condition was reworked to require both repository matching and branch checks. A teammate scanning the commit history would understand the primary change from this title alone.
Description Check ✅ Passed The pull request description includes both mandatory sections from the template: "What does this PR do?" and "Why is it important?" are both present and clearly filled out. The description explains the change (restricting CD job to the main repository) and the rationale (secrets aren't configured in forks). The "Related issues" section is also addressed with "N/A". While the recommended "How to test this PR" section is missing, the core mandatory sections are complete and provide sufficient context for understanding the change's purpose and scope.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c027999 and 293d43f.

📒 Files selected for processing (2)
  • .github/workflows/cicd.yml (1 hunks)
  • Testcontainers.sln (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Testcontainers.sln
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: ci (Testcontainers.Cassandra, ubuntu-24.04)
  • GitHub Check: ci (Testcontainers.ArangoDb, ubuntu-24.04)
  • GitHub Check: ci (Testcontainers.BigQuery, ubuntu-24.04)
  • GitHub Check: ci (Testcontainers.Bigtable, ubuntu-24.04)
  • GitHub Check: ci (Testcontainers.Azurite, ubuntu-24.04)
  • GitHub Check: ci (Testcontainers.ActiveMq, ubuntu-24.04)
  • GitHub Check: analyze (csharp)
🔇 Additional comments (1)
.github/workflows/cicd.yml (1)

92-92: Condition correctly restricts CD job to main repository on develop/main branches.

The added condition properly prevents the CD job from running in forks (where secrets aren't configured) while preserving execution in the main repository. The logic is sound: the CI job runs for all triggers, while the CD job now gates on both repository identity and branch name.

To confirm the condition works as intended, verify that:

  1. github.ref_name is available and correct in all trigger contexts (push, pull_request, workflow_dispatch)
  2. The JSON parsing with fromJson() is valid GitHub Actions syntax
  3. Forked PRs skip the CD job as expected

Run a test by opening a PR from a fork, or check the workflow logs for an existing fork to confirm the CD job is skipped.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2e32476 and c027999.

📒 Files selected for processing (2)
  • .github/workflows/cicd.yml (1 hunks)
  • Testcontainers.sln (2 hunks)
🔇 Additional comments (1)
.github/workflows/cicd.yml (1)

92-92: LGTM! Repository check correctly prevents fork execution.

The CD job now requires both the correct repository and branch, preventing failures on forks where secrets are unavailable.

That is, run it only from the testcontainers/testcontainers-dotnet repository.

The secrets required for the `cd` job to run successfully won't be configured in the forks anyway.
@0xced 0xced force-pushed the feature/cd-fork-friendly branch from c027999 to 293d43f Compare October 23, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant