Skip to content

Skip previews on PRs from forks#46

Merged
Zahnentferner merged 1 commit intoDjedAlliance:mainfrom
AlexITC:skip-previews-on-forks
Mar 8, 2026
Merged

Skip previews on PRs from forks#46
Zahnentferner merged 1 commit intoDjedAlliance:mainfrom
AlexITC:skip-previews-on-forks

Conversation

@AlexITC
Copy link
Contributor

@AlexITC AlexITC commented Mar 5, 2026

Due to security constraints, there is no way to generate previews from forks, let's skip the job instead of letting it fail.

Addressed Issues:

Screenshots/Recordings:

Codepreview step is not failing anymore:
image

On PRs from the same repo, codepreview runs as expected:

image

Additional Notes:

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • If applicable, I have made corresponding changes or additions to the documentation
  • If applicable, I have made corresponding changes or additions to tests
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contribution Guidelines
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.

AI Usage Disclosure

Check one of the checkboxes below:

  • This PR does not contain AI-generated code at all.
  • This PR contains AI-generated code. I have read the AI Usage Policy and this PR complies with this policy. I have tested the code locally and I am responsible for it.

I have used the following AI models and tools: TODO

⚠️ AI Notice - Important!

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact. AI slop is strongly discouraged and may lead to banning and blocking. Do not spam our repos with AI slop.

Summary by CodeRabbit

  • Chores
    • Updated CI/CD workflow to skip preview deployments for pull requests from forked repositories, while continuing to deploy previews for non-fork pull requests and other event types.

@coderabbitai
Copy link

coderabbitai bot commented Mar 5, 2026

📝 Walkthrough

Walkthrough

The GitHub Actions workflow .github/workflows/codepreview.yml adds a skip-if-fork job that prints skip messages for forked PRs. The existing preview job now has an if guard so it runs only for non-pull_request events or PRs where the head repo matches the base repo.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow
.github/workflows/codepreview.yml
Added skip-if-fork job that runs for forked pull requests and prints skip messages. Modified preview job to include `if: ${{ github.event_name != 'pull_request'

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 I nibble on branches and check every fork,
If the head's not at home, I kindly abort,
A soft little hop, a message I sing,
Preview waits for the repo where it belongs,
Hooray for safe runs and neat CI springs!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Skip previews on PRs from forks' directly and clearly summarizes the main change: adding logic to skip preview generation for pull requests from forked repositories.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@AlexITC AlexITC marked this pull request as ready for review March 5, 2026 19:30
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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/codepreview.yml:
- Line 23: The workflow conditions reference github.event.pull_request.* even
when the workflow can be triggered by push, causing incorrect job skipping;
update the conditional expressions used in the preview/skip-if-fork job(s) to
first check the event type (e.g., ensure github.event_name == 'pull_request')
before accessing github.event.pull_request, for example by combining the checks
so the existing github.event.pull_request.head.repo.full_name ==
github.repository (and the similar check on Line 71) only runs when
github.event_name == 'pull_request'.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 70f863f9-16a8-4257-bcba-4fa622ea3273

📥 Commits

Reviewing files that changed from the base of the PR and between da4bec7 and 6412412.

📒 Files selected for processing (1)
  • .github/workflows/codepreview.yml

Due to security constraints, there is no way to generate previews from forks, let's skip the job instead of letting it fail.
@AlexITC AlexITC force-pushed the skip-previews-on-forks branch from 6412412 to 88ed097 Compare March 5, 2026 19:36
@Zahnentferner Zahnentferner merged commit 60eddcd into DjedAlliance:main Mar 8, 2026
3 checks passed
@AlexITC AlexITC deleted the skip-previews-on-forks branch March 8, 2026 18:41
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.

2 participants