As a developer, you need to add the correct syntax to allow the following workflow file to be triggered by multiple types of events.
Which two code blocks should you add starting at line 5? Each correct answer presents a complete solution.
NOTE: Each correct answer is worth one point.
4 name: Node CI/CD
5
6
7
8 jobs:
9 build:
10 runs-on:
11 steps:
12 - uses: actions/checkout@v2
13 - uses: actions/setup-node@v1
14 with:
15 node-version: 12
16 - run: npm ci
17 - run: npm test
18
A workflow can be triggered by multiple events either by using array syntax, such as on: [push, pull_request], or by configuring each event separately when filters or activity types are needed. Option C is valid because both push and pull_request are supported workflow events. Option E is also valid because it configures two event triggers: push filtered to the main branch and release filtered to the created activity type. Option B is invalid because commit is not a GitHub Actions workflow event. Option A wrongly puts environments under on. Option D defines branch filters without an event. Option F uses initiate, which is not a valid event. GitHub documents both multiple-event array syntax and separate event configuration for filters.
Currently there are no comments in this discussion, be the first to comment!