How can I restrict deploy stage only be used in upstream repository not in forked repository
I problem I found was when I forked upstream repository to my repository. While I was developing and pushing to my repository, the gitlab-ci ran tasks that had written in gitlab-ci.yml. The test task had been executed and deploy task also but I did not want the deploy task to be executed in forked branch.
This is my current gitlab-ci.yml
stages:
- build
- test
- deploy
cache:
key: "$CI_BUILD_REF_NAME"
untracked: true
paths:
- node_modules/
perform-testing:
stage: test
script:
- npm test
tags:
- docker
development-push:
stage: deploy
environment: development
script:
- DO_SOME_TASK
tags:
- shell
only:
- development
staging-push:
stage: deploy
environment: staging
script:
- DO_SOME_TASK
tags:
- shell
only:
- master
Was this problem already solved before ? Any solutions on the current gitlab-ci ?