Skip to content

Do not run cron workflows in forks #26684

Discussion options

You must be logged in to vote

@jacobtomlinson ,

In the workflow, you can use the property github.repository of github context, or the environment variable GITHUB_REPOSITORY, to view the repository where the current workflow is running on.

You can use the if conditional to skip all the jobs of the scheduled workflow according to the repository.

For example, the main repository is _ main_org/main_repo _:

Jobs:
  build:
    if: (github.event_name == 'schedule' && github.repository == 'main_org/main_repo') || (github.event_name != 'schedule')
    . . .

This workflow will execute the job _ build _ only when meeting one of the following situations:

  1. The event is _ schedule  and the repository is  main_org/main_repo , if t…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants