Skip to content

Latest commit

 

History

History
14 lines (10 loc) · 590 Bytes

run-action-in-templated-repo-only.md

File metadata and controls

14 lines (10 loc) · 590 Bytes

Run action in a templated repository only

Defining GitHub actions in template repositories that do not run in the template repo itself but in copies of the template repo only is possible by using an if statement that checks the github.repository variable.

jobs:
  my-job:
    runs-on: ubuntu-latest

    # only run action in copies of this repo
    if: ${{ github.repository != 'sophiamersmann/my-template-repo' }}

Here, sophiamersmann/my-template-repo is the template repository. This runs the action only in repositories other than sophiamersmann/my-template-repo.