I am trying to build out some pipeline templates for my team but I am having some trouble executing a common script that lives in the templates repository.
My application and actions repository structure is as follows:
App-Repo
pipeline.yaml
Template Repo
run: ./github/scripts/test.sh
When I run the action in the App-Repo
it says that the file or directory is not found. The problem here is that the runner is using App-Repo
as its directory.
I want to keep this script in the templates because it will be common across many projects. Is there any way to pull this file/s in? Other than manually importing that repo.
Thanks, Craig
I have setup a similar layout with multiple shared repositories for workflows, scripts, and composite actions.
There is no magic to have anything to be immediately available inside of a runner, so the simplest way is just to use actions/checkout with your template repo.
steps:
- name: 'Checkout: local'
uses: actions/checkout@v3
- name: 'Checkout: Template Repo'
uses: actions/checkout@v3
with:
repository: org/templates
path: 'templates'
- run: ./templates/./github/scripts/test.sh
In this example the path
is irrelevant, but it is where the the repo will be cloned into.