So I have a project that needs a "fake" API to do some functional testing on user scenarios; so my idea was creating a simple little node.js project and getting to return some dummy json data depending on a few endpoints to test several use cases of my application.
I have a separate repository containing this fake API and I'm wondering how I should go about adding it into my github actions workflow?
You can use actions/checkout@v2
to pull another repo into your worker.
See the example below:
name: PullExternalRepo
on: workflow_dispatch
jobs:
PullRepo:
runs-on: ubuntu-latest
- name: Install Node
uses: actions/setup-node@v2-beta
with:
node-version: '12'
- name: Install external repo
uses: actions/checkout@v2
with:
repository: your_org/repo_name
path: './place/to/clone/repo/into'
- name: Install deps and run
run: |
cd ./place/to/clone/repo/into
npm install
npm start
Added note about pulling specific branches:
If you are trying to pull a non-default branch, you need to add the ref
property to the checkout action, as seen in the example below.
...
- name: Install external repo
uses: actions/checkout@v2
with:
repository: your_org/repo_name
path: './place/to/clone/repo/into'
ref: 'some-other-branch'
...