Skip to content
Merged
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
31 changes: 31 additions & 0 deletions .github/workflows/fork-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: fork-check

on:
pull_request_target:
types: [opened, reopened, synchronize, edited]

permissions:
issues: write
pull-requests: write

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'
});
Loading