Strallia: Test PR to Test Github Actions Workflow #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |