Complete the code to specify the branch to trigger the pipeline in a GitHub Actions workflow.
on:
push:
branches:
- [1]The main branch is commonly used as the primary branch to trigger CI/CD pipelines.
Complete the code to install dependencies in a React Native project using npm in a GitHub Actions step.
- name: Install dependencies
run: npm [1]npm start which runs the app instead of installing.npm build which is not a valid npm command.The npm install command installs all dependencies listed in package.json.
Fix the error in the GitHub Actions step to run tests with Jest.
- name: Run tests
run: npm [1] testrun causes npm to misinterpret the command.npm test alone is valid but not with an extra test argument.The correct command to run a script named test in npm is npm run test.
Fill both blanks to define a job that runs on Ubuntu and checks out the code.
jobs:
build:
runs-on: [1]
steps:
- uses: [2]The job runs on the latest Ubuntu runner and uses the actions/checkout@v3 action to get the repository code.
Fill all three blanks to create a step that caches npm dependencies to speed up the pipeline.
- name: Cache npm dependencies uses: [1] with: path: [2] key: $[3]
This step uses the actions/cache@v3 action to cache the ~/.npm folder. The cache key uses the OS and the hash of package-lock.json to create a unique cache.