GitHub Certification Certification GitHub-Actions Sample Questions Reliable [Q40-Q63]

Share

GitHub Certification Certification GitHub-Actions Sample Questions Reliable

Prepare for the Actual GitHub Certification GitHub-Actions Exam Practice Materials Collection

NEW QUESTION # 40
As a DevOps engineer, you are developing a container action. You need to execute a cleanup script after completing the main script execution. Which code block should be used to define the cleanup script?

  • A.
  • B.
  • C.
  • D.

Answer: D

Explanation:
The correct syntax for specifying a cleanup script to be run after the main entry point is executed in a Docker- based GitHub Action is to use thepostkey. This ensures thatcleanup.shruns after the main script (main.sh) has completed.


NEW QUESTION # 41
As a developer, which workflow steps should you perform to publish an image to the GitHub Container Registry? (Choose three.)

  • A. Pull the image from the GitHub Container Registry.
  • B. Authenticate to the GitHub Container Registry.
  • C. Use the actions/setup-docker action
  • D. Build the container image.
  • E. Push the image to the GitHub Container Registry

Answer: B,C,E

Explanation:
A: Use the actions/setup-docker action
B: Authenticate to the GitHub Container Registry.
C: Build the container image.
D: Push the image to the GitHub Container Registry
E: Pull the image from the GitHub Container Registry.


NEW QUESTION # 42
As a developer, you are optimizing a GitHub workflow that uses and produces many different files. You need to determine when to use caching versus workflow artifacts. Which two statements are true? (Choose two.)

  • A. Use artifacts when referencingfiles produced by a job after a workflow has ended.
  • B. Use cachingwhen reusing files that change rarely between jobs or workflow runs.
  • C. Use caching to store cache entries for up to 30 days between accesses.
  • D. Use artifacts to access theGitHub Package Registry and download a package for a workflow

Answer: A,B

Explanation:
Caching is ideal for files that change rarely, such as dependencies or build outputs, as it speeds up subsequent workflow runs by reusing previously cached files instead of re-downloading or rebuilding them.
Artifacts are used for persisting files produced during a job that need to be used in later jobs or after the workflow has ended, allowing them to be downloaded or referenced later.


NEW QUESTION # 43
What is the minimal syntax for declaring an output named foo for an action?

  • A.
  • B.
  • C.
  • D.

Answer: A

Explanation:
The correct minimal syntax for declaring an output in GitHub Actions is by using thefookey underoutputs, and associating it with avalue(in this case,Some value). This is the simplest form to define an output in a workflow or action.


NEW QUESTION # 44
As a developer, your self-hosted runner sometimes looses connection while running jobs. How should you troubleshoot the issue affecting your self-hosted runner?

  • A. Set the DEBUG environment variable to true before starting the self-hosted runner to produce more verbose console output.
  • B. Locate the self-hosted runner in your repository's settings page and download its log archive.
  • C. Start the self-hosted runner with the --debug flag to produce more verbose console output.
  • D. Access the self-hosted runner's installation directory and look for log files in the _diag folder.

Answer: D

Explanation:
When troubleshooting a self-hosted runner, you can access the_diagfolder located in the self-hosted runner's installation directory. This folder contains diagnostic logs that can help you identify the root cause of issues, such as connection problems.


NEW QUESTION # 45
You are a developer, and your container jobs are failing on a self-hosted runner. Which requirements must you check to ensure that the self-hosted runner is properly configured? (Choose two.)

  • A. The service status of Kubernetes is "active".
  • B. The self-hosted runner is running a Linux operating system.
  • C. The self-hosted runner is running a Windows operating system.
  • D. Docker is installed on the self-hosted runner.
  • E. Kubernetes is installed on the self-hosted runner.

Answer: B,D

Explanation:
While Docker can run on various operating systems, Linux is often the most common and preferred OS for containerized workloads. Docker works well on Linux and is a widely-used platform for running containers.
For container jobs to run on a self-hosted runner, Docker must be installed and properly configured on the runner. Docker is required to build and run containerized workloads in a GitHub Actions workflow.


NEW QUESTION # 46
Which choices represent best practices for publishing actions so that they can be consumed reliably? (Choose two.)

  • A. organization name
  • B. commit SHA
  • C. repo name
  • D. default branch
  • E. tag

Answer: B,E

Explanation:
Using a tag is a best practice because tags are immutable and represent a fixed version of your action. By referencing tags, consumers of your action can be assured they are using a stable and specific version of the action, which helps in avoiding issues with breaking changes.
The commit SHA is another reliable way to specify a particular version of an action. By referencing a specific commit SHA, consumers can ensure they are using exactly the code that was written at that moment, avoiding the potential for changes in the future.


NEW QUESTION # 47
Which of the following commands will set the $FOO environment variable within a script, so that it may be used in subsequent workflow job steps?

  • A. run: echo "::set-env name=FOO::bar"
  • B. run: export FOO=bar
  • C. run: echo ${{ $FOO=bar }}
  • D. run: echo "FOO=bar" >> $GITHUB_ENV

Answer: D

Explanation:
The $GITHUB_ENV environment variable is used to set environment variables that persist across steps in a workflow job. By echoing FOO=bar into $GITHUB_ENV, the variable FOO will be available in subsequent steps within the same job.


NEW QUESTION # 48
Which workflow commands send information from the runner? (Choose two.)

  • A. populating variables in a Dockerfile
  • B. setting a debug message
  • C. setting output parameters
  • D. reading from environment variables

Answer: B,C

Explanation:
Setting a debug message using ::debug:: command sends a message to the logs, helping with troubleshooting and providing insight into the workflow run.
Setting output parameters using ::set-output sends data from a job step to subsequent steps or jobs, which can be used later in the workflow.


NEW QUESTION # 49
In which locations can actions be referenced by workflows? (Choose three.)

  • A. a published Docker container image on Docker Hub
  • B. the same repository as the workflow
  • C. an .action extension file in the repository
  • D. the runs-on: keyword of a workflow file
  • E. a public NPM registry
  • F. a separate public repository
  • G. the repository's Secrets settings page

Answer: A,B,F

Explanation:
Actions can be stored in a separate public repository and referenced in workflows by specifying the repository and action name.
Actions can also be stored in the same repository as the workflow and referenced directly by their path (e.g., ./.
github/actions/my-action).
Actions can be packaged as Docker container images and published to Docker Hub. These can then be referenced in workflows by specifying the Docker image.


NEW QUESTION # 50
Which default GitHub environment variable indicates the owner and repository name?

  • A. ENV REPOSITORY
  • B. GITHUB REPOSITORY
  • C. REPOSITORY NAME
  • D. GITHUB WORKFLOW REPO

Answer: C

Explanation:
The GITHUB_REPOSITORY environment variable contains the owner and repository name in the format owner/repository. It is automatically provided by GitHub Actions and can be used to reference the repository in workflows.


NEW QUESTION # 51
How can GitHub Actions encrypted secrets be used in if: conditionals within a workflow job?

  • A. Use a workflow command to expose the encrypted secret via a step's output parameter and then use the step output in the job's if: conditional.
  • B. Use the secrets context within the conditional statement, e.g. ${{ secrets.MySuperSecret }}.
  • C. Create a job dependency that exposes the encrypted secret as a job output, which can then be leveraged in a subsequent dependent job.
  • D. Set the encrypted secret as a job-level environment variable and then reference the environment variable within the conditional statement.

Answer: B

Explanation:
GitHub Actions encrypted secrets can be accessed in workflows using thesecretscontext. You can directly reference the secret within anif:conditional using${{ secrets.MySuperSecret }}to determine whether a job or step should run based on the secret's value.


NEW QUESTION # 52
You are reaching your organization's storage limit for GitHub artifacts and packages. What should you do to prevent the storage limit from being reached?

  • A. via repositories owned by the organization
  • B. via the .github repository owned by the organization
  • C. via the GitHub Marketplace
  • D. via a repository owned by a third party

Answer: A

Explanation:
To prevent reaching the storage limit for GitHub artifacts and packages, you should manage and clean up artifacts and packages stored in repositories owned by your organization. This includes deleting unnecessary artifacts and managing the lifecycle of packages, as they contribute directly to your organization's storage quota.


NEW QUESTION # 53
Which of the following scenarios requires a developer to explicitly use the GITHUB_TOKEN or github.token secret within a workflow? (Choose two.)

  • A. making an authenticated GitHub API request
  • B. assigning non-default permissions to the GITHUB_TOKEN
  • C. passing the GITHUB_TOKEN secret to an action that requires a token as an input
  • D. checking out source code with the actions/checkout@v3 action

Answer: A,C

Explanation:
Some actions may require a GITHUB_TOKEN as an input to authenticate and perform specific tasks, such as creating issues, commenting on pull requests, or interacting with the GitHub API. In such cases, you would need to explicitly pass the token to the action.
When making an authenticated GitHub API request, the GITHUB_TOKEN is required to authenticate the request. This token is automatically provided by GitHub in the workflow, and it must be explicitly used when interacting with the GitHub API.


NEW QUESTION # 54
How should you install the bats NPM package in your workflow?

  • A.
  • B.
  • C.
  • D.

Answer: C

Explanation:
The correct syntax includes specifying the job (example-job), the runner (ubuntu-latest), and the necessary step (npm install -g bats) within the workflow. This ensures that the package is installed properly during the execution of the job.


NEW QUESTION # 55
What are the two types of environment protection rules you can configure? (Choose two.)

  • A. artifact storage
  • B. required reviewers
  • C. wait timer
  • D. branch protections

Answer: B,C

Explanation:
Required reviewers is a protection rule where you can specify that certain individuals or teams must review and approve the workflow run before it can proceed. This is used to enforce approvals before certain steps or environments are accessed.
Wait timer is a protection rule that introduces a delay before a workflow can proceed to the next stage. This is useful for adding time-based constraints to the deployment process or ensuring that certain conditions are met before a workflow continues.


NEW QUESTION # 56
You need to trigger a workflow using the GitHub API for activity that happens outside of GitHub. Which workflow event do you use?

  • A. workflow_run
  • B. check_suite
  • C. repository_dispatch
  • D. deployment

Answer: C

Explanation:
Therepository_dispatchevent allows you to trigger a workflow in response to external activity. It is commonly used when you need to trigger a workflow from outside GitHub, such as from another system or service, by sending a request to the GitHub API. This event provides flexibility to integrate with various external systems and trigger workflows in a GitHub repository.


NEW QUESTION # 57
When reviewing an action for use, what file defines its available inputs and outputs?

  • A. inputs.yml
  • B. action.yml
  • C. config.json
  • D. defaults.json
  • E. workflow.yml

Answer: B

Explanation:
The action.yml file defines the inputs and outputs for a GitHub Action. This file contains metadata about the action, including the required inputs and outputs, as well as other configurations like the action's description, runs, and environment setup.


NEW QUESTION # 58
Scheduled workflows run on the:

  • A. latest commit from the branch named main,
  • B. latest commit and branch on which the workflow was triggered,
  • C. latest commit from the branch named schedule,
  • D. latest commit on the default or base branch
  • E. specified commit and branch from the workflow YAML file,

Answer: B

Explanation:
Scheduled workflows in GitHub Actions are triggered at specified times, and they run on the latest commit of the branch that triggers the workflow. This means the workflow will run on the most recent commit on the branch that was active at the time the scheduled event occurs.


NEW QUESTION # 59
Which of the following statements are true regarding the use of GitHub Actions on a GitHub Enterprise Server instance? (Choose three.)

  • A. Third party actions can be manually synchronized for use on GitHub Enterprise Server
  • B. Actions created by GitHub are automatically available and cannot be disabled
  • C. Third party actions can be used on GitHub Enterprise Server by configuring GitHub Connect
  • D. Actions must be defined in the .github repository
  • E. Most GitHub authored actions are automatically bundled for use on GitHub Enterprise Server
  • F. Use of GitHub Actions on GitHub Enterprise Server requires a persistent internet connection

Answer: A,C,F

Explanation:
GitHub Actions on GitHub Enterprise Server often requires an internet connection, especially for accessing actions from the GitHub Marketplace or third-party actions unless they are manually synced to the server.
To use third-party actions on GitHub Enterprise Server, GitHub Connect can be used to establish a connection between the server and GitHub.com, enabling access to third-party actions.
Third-party actions can also be manually synchronized to the GitHub Enterprise Server, making them available for use in workflows.


NEW QUESTION # 60
You need to create new workflows to deploy to an unfamiliar cloud provider. What is the fastest and safest way to begin?

  • A. Use the actions/jenkins-plugin action to utilize an existing Jenkins plugin for the cloud provider.
  • B. Create a custom action to wrap the cloud provider's CLI.
  • C. Search GitHub Marketplace for actions created by GitHub.
  • D. Download the CLI for the cloud provider and review the associated documentation.
  • E. Search GitHub Marketplace for verified actions published by the cloud provider.

Answer: E

Explanation:
Searching the GitHub Marketplace for verified actions published by the cloud provider is the quickest and safest approach. Many cloud providers offer verified GitHub Actions that are maintained and optimized to interact with their services. These actions typically come with the correct configurations and best practices, allowing you to get started quickly without reinventing the wheel.


NEW QUESTION # 61
As a developer, you want to run a workflow from the Actions tab in GitHub. Which YAML snippet should you use to match the interface in this image?

  • A.
  • B.
  • C.
  • D.

Answer: A

Explanation:
The first image shows a workflow trigger with an option for the test suite, and the chosen YAML configuration matches this interface. Specifically, the test suite input is defined withtype: choiceand includes the optionvalue: functional, which aligns with the visible UI elements in the first image.


NEW QUESTION # 62
As a developer, you are optimizing a GitHub workflow that uses and produces many different files. You need to determine when to use caching versus workflow artifacts. Which two statements are true? (Choose two.)

  • A. Use artifacts when referencingfiles produced by a job after a workflow has ended.
  • B. Use cachingwhen reusing files that change rarely between jobs or workflow runs.
  • C. Use caching to store cache entries for up to 30 days between accesses.
  • D. Use artifacts to access theGitHub Package Registry and download a package for a workflow

Answer: A,B


NEW QUESTION # 63
......


GitHub GitHub-Actions Exam Syllabus Topics:

TopicDetails
Topic 1
  • Create and publish custom GitHub actions: This section of the exam measures the skills of Software Engineers and covers the creation and publication of custom GitHub actions.
Topic 2
  • Leverage GitHub Actions to publish to GitHub Packages: This section of the exam measures the skills of Software Engineers and Package Managers and covers the use of GitHub Actions for publishing to GitHub Packages. It focuses on setting up CI workflows for package publishing and authentication. One skill to be measured is configuring workflows to publish to package registries.
Topic 3
  • Manage GitHub Actions in the enterprise: This section of the exam measures the skills of GitHub Managers and covers managing GitHub Actions at the enterprise level. It emphasizes tools for action and workflow management, runner configurations, and encrypted secrets usage. A skill to be measured is customizing self-hosted runners for enterprise use cases.
Topic 4
  • Automate development tasks by using GitHub Actions: This section of the exam measures the skills of DevOps Engineers and covers the fundamentals of GitHub Actions. It focuses on understanding action types, planning automation workflows, and creating container actions. One skill to be measured is creating workflows triggered by repository events.
Topic 5
  • Build continuous integration (CI) workflows by using GitHub Actions: This section of the exam measures the skills of Software Engineers and covers essential features for building robust CI workflows. It emphasizes building and testing projects, debugging failed tests, and customizing workflows. A skill to be measured is troubleshooting CI pipelines using GitHub Actions logs.

 

Ace GitHub GitHub-Actions Certification with Actual Questions Mar 31, 2025 Updated: https://selftestengine.testkingit.com/GitHub/latest-GitHub-Actions-exam-dumps.html