Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions .github/workflows/crucible-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
.github/rulesets/**
.github/workflows/run-crucible-tracking.yaml
.github/workflows/crucible-ci.yaml
.github/workflows/fork-check.yaml
.github/workflows/controller-build.yaml
.github/workflows/unittest.yaml
docs/**
Expand All @@ -34,7 +35,7 @@ jobs:

call-real-core-release-crucible-ci:
needs: changes
if: ${{ github.event_name == 'workflow_dispatch' || needs.changes.outputs.only-docs != 'true' }}
if: ${{ github.event.pull_request.head.repo.fork != true && (github.event_name == 'workflow_dispatch' || needs.changes.outputs.only-docs != 'true') }}
uses: perftool-incubator/crucible-ci/.github/workflows/core-release-crucible-ci.yaml@main
with:
ci_target: "multiplex"
Expand All @@ -47,7 +48,7 @@ jobs:

call-faux-core-release-crucible-ci:
needs: changes
if: ${{ github.event_name != 'workflow_dispatch' && needs.changes.outputs.only-docs == 'true' }}
if: ${{ github.event.pull_request.head.repo.fork != true && github.event_name != 'workflow_dispatch' && needs.changes.outputs.only-docs == 'true' }}
uses: perftool-incubator/crucible-ci/.github/workflows/faux-core-release-crucible-ci.yaml@main

crucible-ci-complete:
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/fork-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: fork-check

on:
pull_request_target:
types: [opened, reopened]

jobs:
block-fork-pr:
if: github.event.pull_request.head.repo.fork == true
runs-on: ubuntu-latest
steps:
- name: Comment and close fork PR
uses: actions/github-script@v7
with:
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: 'This PR was opened from a fork. PRs must be opened from branches on the upstream repository so that CI workflows have access to required secrets and variables.\n\nPlease push your branch to this repository and open a new PR.\n\nClosing this PR automatically.'
});
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
state: 'closed'
});
5 changes: 3 additions & 2 deletions .github/workflows/unittest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
.github/rulesets/**
.github/workflows/run-crucible-tracking.yaml
.github/workflows/crucible-ci.yaml
.github/workflows/fork-check.yaml
.github/workflows/controller-build.yaml
.github/workflows/unittest.yaml
docs/**
Expand All @@ -35,7 +36,7 @@ jobs:
multiplex-unittests:
runs-on: ubuntu-latest
needs: changes
if: ${{ github.event_name == 'workflow_dispatch' || needs.changes.outputs.only-docs != 'true' }}
if: ${{ github.event.pull_request.head.repo.fork != true && (github.event_name == 'workflow_dispatch' || needs.changes.outputs.only-docs != 'true') }}
steps:
- uses: actions/checkout@v4

Expand All @@ -59,7 +60,7 @@ jobs:
faux-unittest:
runs-on: ubuntu-latest
needs: changes
if: ${{ github.event_name != 'workflow_dispatch' && needs.changes.outputs.only-docs == 'true' }}
if: ${{ github.event.pull_request.head.repo.fork != true && github.event_name != 'workflow_dispatch' && needs.changes.outputs.only-docs == 'true' }}
steps:
- run: echo "faux-unittest-complete"

Expand Down
Loading