The 'java-version' parameter must be a string, so it should be '11' with quotes.
Step 2: Verify other parts
Though 'on' is missing, the question focuses on the snippet error; 'mvn clean test' is correct; 'actions/checkout@v3' is current.
Final Answer:
java-version should be a string, e.g., '11' -> Option A
Quick Check:
Java version needs quotes = A [OK]
Hint: Always quote Java version in setup-java 'with' block [OK]
Common Mistakes:
Using number instead of string for java-version
Confusing order of mvn commands
Assuming checkout action is outdated
5. You want to run Selenium Java tests on both push and pull request events, but only for the 'develop' and 'release' branches. Which is the correct 'on' configuration in your GitHub Actions workflow?
hard
A. on:
push:
branches: [develop]
pull_request:
branches: [release]
B. on:
push:
branches: [main]
pull_request:
branches: [main]
C. on:
push:
branches-ignore: [develop, release]
pull_request:
branches-ignore: [develop, release]
D. on:
push:
branches: [develop, release]
pull_request:
branches: [develop, release]
Solution
Step 1: Understand event triggers for push and pull_request
You want both push and pull_request events to trigger on 'develop' and 'release' branches.
Step 2: Check correct syntax for multiple branches
Use 'branches' with a list of branch names under both push and pull_request keys.
Final Answer:
on:
push:
branches: [develop, release]
pull_request:
branches: [develop, release] -> Option D
Quick Check:
Push and PR on develop, release branches = A [OK]
Hint: List branches under both push and pull_request keys [OK]
Common Mistakes:
Using branches-ignore instead of branches
Triggering on wrong branches like main
Separating branches for push and pull_request incorrectly
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.