Skip to content

Prevent actions from running in forks#3938

Merged
cheenamalhotra merged 2 commits into
dotnet:mainfrom
ErikEJ:issue-3924
Feb 6, 2026
Merged

Prevent actions from running in forks#3938
cheenamalhotra merged 2 commits into
dotnet:mainfrom
ErikEJ:issue-3924

Conversation

@ErikEJ

@ErikEJ ErikEJ commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

Description

This change prevents GitHub actions from running in any fork

Issues

fixes #3924

@ErikEJ ErikEJ requested a review from a team as a code owner February 5, 2026 07:19
Copilot AI review requested due to automatic review settings February 5, 2026 07:19
@github-project-automation github-project-automation Bot moved this to To triage in SqlClient Board Feb 5, 2026

Copilot AI left a comment

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.

Pull request overview

This PR adds fork prevention checks to GitHub Actions workflows to ensure they only run in the main repository, not in forked repositories. This addresses issue #3924 by preventing unnecessary workflow executions in forks.

Changes:

  • Added conditional checks to prevent workflows from running in forked repositories
  • Applied the fork check to both the stale issues/PRs cleanup workflow and the CodeQL security analysis workflow

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/stale.yml Added fork check to prevent stale issue/PR cleanup from running in forks
.github/workflows/codeql.yml Added fork check to prevent CodeQL security analysis from running in forks

Comment thread .github/workflows/stale.yml Outdated
jobs:
close-stale:
runs-on: ubuntu-latest
if: github.event.repository.fork != true

Copilot AI Feb 5, 2026

Copy link

Choose a reason for hiding this comment

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

The condition uses != true which will also evaluate to true when the value is null or undefined. For more explicit fork detection, use github.event.repository.fork == false or !github.event.repository.fork to ensure the check only passes when the repository is definitively not a fork.

Suggested change
if: github.event.repository.fork != true
if: github.event.repository.fork == false

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/codeql.yml Outdated

@mdaigle mdaigle left a comment

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.

Thanks!

@cheenamalhotra cheenamalhotra merged commit db47359 into dotnet:main Feb 6, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from To triage to Done in SqlClient Board Feb 6, 2026
@paulmedynski paulmedynski added this to the 7.0.0-preview4 milestone Feb 11, 2026
Copilot AI added a commit that referenced this pull request Feb 11, 2026
Refreshed analysis against current GitHub state (2026-02-11 17:29 UTC):

EXCELLENT NEWS:
✅ ALL 44 PRs now have milestone 7.0.0-preview4 (100% complete!)
✅ Issues #3716, #3736, #3523 now have milestone (originally 0/3, now 3/3)
⚠️ Discovered 1 additional issue #3924 (closed by PR #3938) needs milestone

Updated files:
- MILESTONE_VERIFICATION_SUMMARY.md: Reflects current 100% PR completion
- BASH_ONELINERS.md: Updated verification one-liners for 4 issues
- GH_COMMANDS_ISSUES.md: Updated with current status, only #3924 needs action
- gh-commands-issues-milestone-update.txt: Updated to only include #3924
- simple-issues-milestone-update.sh: Updated to only update #3924
- verify-all-milestones.sh: Added issue #3924 to verification list

Current completion: 47/48 items (97.9%)
Remaining: Only issue #3924 needs milestone assignment

Co-authored-by: paulmedynski <31868385+paulmedynski@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Avoid running GitHub actions on forks

5 participants