Table of Contents
This blog post provides a comprehensive set of practice questions for the GitHub Actions certification exam. Each question is designed to test your knowledge of workflow automation, security best practices, and runner configurations.
Mastering GitHub Actions
Section 1: Workflow Triggers and Events
1. Which GitHub Actions event configuration triggers only for pull requests targeting the release branch and not for push events?
- A.
on: push: branches: - release - B.
on: pull_request: branches: - release - C.
on: pull_request_target: branches: - release - D.
on: pull_request: types: - opened
Answer: B
2. As a DevOps engineer, you need to define a deployment workflow that runs after the build workflow has successfully completed without modifying the build workflow. Which trigger should you use?
- A.
repository_dispatch - B.
workflow_dispatch - C.
workflow_exec - D.
workflow_run
Answer: D
3. Scheduled workflows run on the:
- A. specified commit and branch from the workflow YAML file.
- B. latest commit from the branch named schedule.
- C. latest commit and branch on which the workflow was triggered.
- D. latest commit from the branch named main.
- E. latest commit on the default or base branch.
Answer: E
Section 2: Runner Configuration and Management
4. GitHub-hosted runners support which capabilities? (Choose two.)
- A. requiring a payment mechanism for private repositories
- B. support for a variety of Linux variations including CentOS and Fedora
- C. automatic patching of both the runner and the underlying OS
- D. support for Linux, Windows, and macOS
- E. automatic file-system caching between workflow runs
Answer: C and D
5. You have exactly one Windows x64 self-hosted runner configured with custom tools. Which syntax targets this specific runner?
- A.
runs-on: [self-hosted, windows, x64] - B.
self-hosted: [windows, x64] - C.
runs-on: windows-latest - D.
self-hosted: [windows-x64]
Answer: A
6. As a developer, your self-hosted runner sometimes loses connection while running jobs. How should you troubleshoot this?
- A. Set the
DEBUGenvironment variable to true before starting. - B. Locate the runner in settings and download its log archive.
- C. Access the runner’s installation directory and look for log files in the
_diagfolder. - D. Start the runner with the
--debugflag.
Answer: C
Section 3: Variables and Outputs
7. Which default environment variable specifies the branch or tag that triggered a workflow?
- A.
GITHUB_REF - B.
GITHUB_TAG - C.
ENV_BRANCH - D.
GITHUB_BRANCH
Answer: A
8. Which command can you include in your workflow file to set the output parameter for an action?
- A.
echo "action_color=purple" >> $GITHUB_ENV - B.
echo "::debug::action_color=purple" - C.
echo "::add-mask::$ACTION_COLOR" - D.
echo "action_color=purple" >> $GITHUB_OUTPUT
Answer: D
9. What is the smallest scope for an environment variable?
- A. the workflow settings
- B. a step
- C. a job
- D. the workflow env mapping
Answer: B
Section 4: Security and Secrets
10. In which scenarios could the GITHUB_TOKEN be used? (Choose two.)
- A. to create a repository secret
- B. to add a member to an organization
- C. to read from the file system on the runner
- D. to publish to GitHub Packages
- E. to create issues in the repo
Answer: D and E
11. Your organization manages secrets using GitHub encrypted secrets. You need a version of a secret for a specific repository named MyRepo. How should you store it?
- A. Create a duplicate entry for SuperSecret in the encrypted secret store and specify MyRepo as the scope.
- B. Create
MyRepo_SuperSecretin GitHub encrypted secrets. - C. Create and access SuperSecret from the secrets store in
MyRepo. - D. Create a file with the information in the
.github/secretsfolder.
Answer: A
Section 5: Optimization and Best Practices
12. You are reaching your organization’s storage limit for artifacts. What should you do? (Choose two.)
- A. Configure the artifact and log retention period.
- B. Configure the repo to use Git Large File Storage.
- C. Delete artifacts from the repositories manually.
- D. Disable branch protections.
- E. Use self-hosted runners for all runs.
Answer: A and C
13. When creating and managing custom actions in an enterprise setting, which is a best practice?
- A. creating a separate repository for each action so that the version can be managed independently
- B. creating a separate branch in application repositories.
- C. creating a single repository for all custom actions.
- D. including custom actions in the same repository as application code.
Answer: A
14. Which choices represent best practices for publishing actions so they can be consumed reliably? (Choose two.)
- A. default branch
- B. commit SHA
- C. repo name
- D. tag
Answer: B and D
Section 6: Action Types and Metadata
15. Which files are required for a Docker container action in addition to the source code? (Choose two.)
- A.
action.yml - B.
Actionfile - C.
metadata.yml - D.
Dockerfile
Answer: A and D
16. Which action type should be used to bundle a series of run steps into a reusable custom action?
- A. Composite action
- B. Docker container action
- C. JavaScript action
- D. Bash script action
Answer: A
17. What is the minimal syntax for declaring an output named foo for an action?
- A. (Mapping foo to description)
- B. (Array of key/description)
- C. (Mapping foo to value)
- D. (Array of key/value)
Answer: C