Skip to content

Strallia: Test PR to Test Github Actions Workflow #2

Strallia: Test PR to Test Github Actions Workflow

Strallia: Test PR to Test Github Actions Workflow #2

Workflow file for this run

name: Close PRs from Forks
on:
pull_request:
types:
- opened
- synchronize
jobs:
check-fork:
runs-on: ubuntu-latest
steps:
- name: Check if PR is from a fork
id: check
run: |
echo "PR head repo: ${{ github.event.pull_request.head.repo.full_name }}"
echo "Base repo: ${{ github.event.repository.full_name }}"
if [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.event.repository.full_name }}" ]; then
echo "PR is from a fork"
echo "is_fork=true" >> $GITHUB_ENV
else
echo "PR is not from a fork"
echo "is_fork=false" >> $GITHUB_ENV
- name: Close PR and add comment
if: env.is_fork == 'true'
run: |
gh pr close --comment " This PR has been closed because PRs from forks are not allowed.
Please create a branch directly off the origin repository and resubmit your PR."
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}