Complete the code to specify the event that triggers the GitHub Action workflow.
on: [1]The push event triggers the workflow when code is pushed to the repository.
Complete the code to define the job name in the workflow.
jobs:
build:
[1]: ubuntu-latestThe runs-on key specifies the type of machine the job will run on, such as 'ubuntu-latest'.
Fix the error in the step that runs a shell command.
steps:
- name: Run a command
run: [1]The run key expects the shell command directly, like 'echo Hello World'. Adding 'run' again or extra colons causes errors.
Fill both blanks to set up a step that checks out the repository code.
steps:
- name: Checkout code
uses: [1]
with:
[2]: 'v3'The uses key specifies the action to use, here 'actions/checkout@v3'. The with key can specify parameters like 'version' to choose the version tag.
Fill all three blanks to create a step that sets up Node.js version 16 and runs npm install.
steps: - uses: actions/setup-node@[1] with: node-version: '[2]' - name: Install dependencies run: [3]
The setup-node action version is often 'v2'. The Node.js version is set with 'node-version'. The command to install packages is 'npm install'.