Skip to content

Do not run several CI jobs on forks#8132

Merged
samsonasik merged 1 commit into
rectorphp:mainfrom
simonschaufi:9790
Jul 2, 2026
Merged

Do not run several CI jobs on forks#8132
samsonasik merged 1 commit into
rectorphp:mainfrom
simonschaufi:9790

Conversation

@simonschaufi

Copy link
Copy Markdown
Contributor

@simonschaufi

simonschaufi commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@TomasVotruba I'm a little bit confused because sometimes it's written as
if: github.event.pull_request.head.repo.full_name == 'rectorphp/rector-src'
and sometime as
if: github.repository == 'rectorphp/rector-src'.
Are they the same or do they behave differently?

@samsonasik

Copy link
Copy Markdown
Member

That depends on even, if specifically on pull request even, use:

github.event.pull_request.head.repo.full_name should be used as far as I know, ref usage on other repos

https://github.com/kahlan/kahlan/blob/bb577be343fc1c44f139522164e89afdc0d70b1e/.github/workflows/build.yml#L45

@TomasVotruba TomasVotruba requested a review from samsonasik July 1, 2026 15:47
@simonschaufi

Copy link
Copy Markdown
Contributor Author

ok, what i want is that the job doesn't run on PRs and on main branch as forks should only run tests, nothing else

Comment thread .github/workflows/rector_drupal_rector_dev.yaml Outdated
Comment thread .github/workflows/rector_laravel_rector_dev.yaml Outdated
@samsonasik

Copy link
Copy Markdown
Member

On usage even, please use github.event.pull_request.head.repo.full_name

@simonschaufi

Copy link
Copy Markdown
Contributor Author

On usage even, please use github.event.pull_request.head.repo.full_name

I think in this case the scheduler runs on main branch and not on a PR

@samsonasik

Copy link
Copy Markdown
Member

github.event.pull_request.head.repo.full_name check ensure the even not run when fork user create PR to this repo.

@simonschaufi

Copy link
Copy Markdown
Contributor Author

Yes, but forks should also not run scheduled tasks:

on:
    schedule:
        - cron: '0 */12 * * *'   # every 12 hours

@samsonasik

Copy link
Copy Markdown
Member

Okay, let's give it a try 👍

@samsonasik samsonasik merged commit f1aefb6 into rectorphp:main Jul 2, 2026
65 checks passed
@samsonasik

Copy link
Copy Markdown
Member

Thank you @simonschaufi

@simonschaufi simonschaufi deleted the 9790 branch July 2, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Run claude Action only on main repo and not in forks

2 participants