GH-200 practice question 3 of 15

Where should workflow files be stored to be triggered by events in a repository?

Full set: 100 questions
Answer options
A: .github/workflows/ Correct answer
B: .github/actions/
C: Nowhere; they must be attached to an act on in the GitHub user interface
D: anywhere
E: .workflows/
Correct Answer:
A. .github/workflows/
Explanation

GitHub Actions discovers and executes workflows based on a specific directory structure within a repository. All workflow files, which are written in YAML format, must be stored in the .github/workflows/ directory. Any .yml or .yaml file placed in this directory will be automatically processed by GitHub Actions as a workflow that can be triggered by specified events. Storing the files elsewhere will prevent GitHub from recognizing and running them.

Why Incorrect

B. The .github/actions/ directory is the conventional location for storing custom composite actions that are local to the repository, not the workflow files that use them.
C. This is incorrect. Workflows are defined as code (.yml files) within the repository's file structure, not attached via the user interface.
D. This is incorrect. GitHub Actions requires workflows to be in a specific, predefined directory; they cannot be placed anywhere.
E. This is incorrect. The .workflows/ directory is missing the required parent .github/ directory.

References

1. GitHub Docs. (n.d.). Understanding the workflow file. Retrieved from https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#understanding-the-workflow-file. (This document states, "You must store workflow files in the .github/workflows directory of your repository.")

2. GitHub Docs. (n.d.). Core concepts for GitHub Actions. Retrieved from https://docs.github.com/en/actions/learn-github-actions/core-concepts-for-github-actions#workflow. (This page defines a workflow as a file that "you add to the .github/workflows directory of your repository.")

Scroll to Top