I have a golang
repo with a react
client. I want to setup up CI using github actions for my client. The React client is inside the client
folder in the workspace. I have written the following workflow
name : Node.js CI
on: [push, pull_request]
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
path: client
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- run: yarn install
- run: yarn build
But on committing it shows the following error
Run yarn build1s
##[error]Process completed with exit code 1.
Run yarn build
yarn run v1.21.1
error Couldn't find a package.json file in "/home/runner/work/evential/evential"
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
##[error]Process completed with exit code 1
The snippet
- uses: actions/checkout@v2
with:
path: client
doesn't make the steps following run inside the client
folder.
Need help. Thanks in advance.
You can use the working-directory
keyword in a run
step. See the documentation here .
- run: yarn install
working-directory: client
- run: yarn build
working-directory: client
Assuming your repository structure looks like this:
.
├── README.md
├── client
│ └── ... # your source files
└── workflows
└── example-ci.yml
You can also set the default working directory for multiple steps using:
defaults:
run:
working-directory: client # The working directory path
This way you don't need to specify it for each steps. You can also adjust the scope depending on where you put the above snippet, either for:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.