Skip to content

Have github action only run on master repo, and not on forks? #26409

Answered by s-weigand
Blakeinstein asked this question in Actions
Discussion options

You must be logged in to vote

@Simran-B gave the solution you want and need 😉

To make the condition more portable (copy/paste) in an organization or your own account you can just use the repository owner name as a condition to match.

In your case just replace

github.com

Upvision/upvision.github.io/blob/41ac1a284e4b3accc09309d852ca3b477d1f395e/.github/workflows/gh-deploy.yml#L10-L11

  1. jobs:
  2. publish:

with

jobs:
  publish:
    if: github.repository_owner == 'Upvision'

For the forks not to be bothered with the failing workflow they just need to update to your version.

Replies: 21 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
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
2 replies
@kingthorin
Comment options

@devedse
Comment options

Comment options

You must be logged in to vote
2 replies
@thbeu
Comment options

@jsoref
Comment options

Comment options

You must be logged in to vote
1 reply
@jsoref
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment