Discover your grasp of setting up and optimizing workflows for continuous integration using automated actions. This quiz covers crucial topics such as workflow configuration, triggering events, environment secrets, caching, and parallel job execution—ideal for professionals seeking practical understanding of continuous integration pipelines.
Which keyword in a workflow configuration specifies the event that should trigger the workflow to run, such as on a code push or a pull request?
Explanation: The correct answer is 'on', which tells the system what event should initiate the workflow. 'trigger' and 'hook' are not valid keywords in this context, although they sound related to the concept of launching tasks. 'start' does not exist as a workflow configuration field. Only 'on' is officially supported and triggers workflows based on defined events.
Suppose you need to safely store an API key for use in your workflow without exposing it in the configuration file. Which method should you use to keep the key confidential within the workflow environment?
Explanation: Environment secrets are designed specifically to store sensitive data like API keys, making them the secure option. Saving credentials in plain text or job outputs would expose them to anyone reading the workflow logs or configuration. Cache variables are meant for preserving build artifacts or dependencies, not confidential information.
If your workflow repeatedly downloads the same dependencies on every run, which built-in feature can you use to speed up the process by saving and restoring files or directories between jobs?
Explanation: The cache feature enables you to save and reuse files like dependencies to reduce download time in repeated runs. Reuse job matrix is not an actual feature but refers to running jobs with variable parameters. Parallel jobs can speed up pipelines but don't directly reuse files. Persisting artifacts is for saving outputs, not for speeding up installation of dependencies.
How can you configure multiple jobs in your workflow to execute at the same time, provided there are no job dependencies specified?
Explanation: 'Needs' dependencies determine execution order; by removing these, jobs without dependencies run simultaneously. Assigning jobs to the same runner does not guarantee parallelism and may limit concurrency. 'Continue-on-error' controls error handling, not parallel execution. Listing multiple jobs under a single step is not valid syntax and doesn't enable parallelism.
In which directory should you place the workflow YAML files so that the automation system can recognize and run them for continuous integration tasks?
Explanation: The correct directory is '.github/workflows/', which is the standard location for workflow files to be recognized and executed. The other folders like '.automation/', '.ci/workflows/', and '.config/pipelines/' might seem plausible but are not officially supported and will not trigger workflows.