[Feb 20, 2025] GitHub-Actions Dumps Full Questions - Exam Study Guide
GitHub Certification Free Certification Exam Material from PassReview with 74 Questions
GitHub GitHub-Actions Exam Syllabus Topics:
| Topic | Details |
|---|---|
| Topic 1 |
|
| Topic 2 |
|
| Topic 3 |
|
| Topic 4 |
|
| Topic 5 |
|
NEW QUESTION # 24
Without the need to use additional infrastructure, what is the simplest and most maintainable method for configuring a workflow job to provide access to an empty PostgreSQL database?
- A. Dynamically provision and deprovision an environment.
- B. It is currently impossible to access the database with GitHub Actions.
- C. Use service containers with a Postgres database from Docker hub.
- D. Run the actions/postgres action in a parallel job.
Answer: C
Explanation:
GitHub Actions supports the use of service containers, which allows you to spin up a PostgreSQL database (or any other service) in a Docker container during your workflow. You can pull a PostgreSQL image from Docker Hub, and the container will automatically be available to your workflow job. This method requires no additional infrastructure and is easy to configure and maintain, as you simply define the container in the workflow file.
NEW QUESTION # 25
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 the GitHub Marketplace
- B. via a repository owned by a third party
- C. via the .github repository owned by the organization
- D. via repositories owned by the organization
Answer: D
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 # 26
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: A
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 # 27
As a developer, you need to create a custom action written in Python. Which action type should you choose?
As a developer, you need to create a custom action written in Python. Which action type should you choose?
- A. composite run step
- B. Python action
- C. JavaScript action
- D. Docker container action
Answer: D
Explanation:
ADocker container actionis ideal for custom actions that require specific environments or dependencies, such as Python. By creating a Docker container, you can define the environment with the necessary Python version and dependencies, and your Python code can run inside that container.
NEW QUESTION # 28
Which workflow event is used to manually trigger a workflow run?
- A. create
- B. workflow_dispatch
- C. status
- D. workflow_run
Answer: B
Explanation:
The workflow_dispatch event is used to manually trigger a workflow run in GitHub Actions. You can specify this event in the workflow file to allow users to manually trigger the workflow from the GitHub UI, often with optional input parameters.
NEW QUESTION # 29
As a DevOps engineer, you are trying to leverage an organization secret in a repo. The value received in the workflow is not the same as that set in the secret. What is the most likely reason for the difference?
- A. The Encrypt Secret setting was not configured for the secret.
- B. The Codespace secret doesn't match the expected value.
- C. There is a different value specified at the enterprise level.
- D. There is a different value specified at the workflow level.
- E. There is a different value specified at the rego level.
Answer: E
Explanation:
GitHub secrets are defined at different levels: organization, repository, and sometimes at the workflow level.
If a secret is defined at both the organization level and the repository level, the repository-level secret will take precedence. So, if the value of the secret differs between these levels, the workflow will use the value from the repository level instead of the organization level.
NEW QUESTION # 30
You are a developer working on developing reusable workflows for your organization. What keyword should be included as part of the reusable workflow event triggers?
- A. pull_request
- B. check_run
- C. workflow_call
- D. workflow_run
Answer: C
Explanation:
The workflow_call event is used to trigger a reusable workflow from another workflow. This allows you to create workflows that can be reused in multiple places within your organization, enabling better modularity and reducing duplication.
NEW QUESTION # 31
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. Start the self-hosted runner with the --debug flag to produce more verbose console output.
- B. Access the self-hosted runner's installation directory and look for log files in the _diag folder.
- C. Set the DEBUG environment variable to true before starting the self-hosted runner to produce more verbose console output.
- D. Locate the self-hosted runner in your repository's settings page and download its log archive.
Answer: B
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 # 32
As a developer, you are using a Docker container action in your workflow. What is required for the action to run successfully?
- A. The job env must be set to a Linux environment.
- B. The action must be published to the GitHub Marketplace.
- C. The referenced action must be hosted on Docker Hub.
- D. The job runs-on must specify a Linux machine with Docker installed.
Answer: D
Explanation:
For a Docker container action to run in a GitHub Actions workflow, the runner must have Docker installed.
The runs-on attribute of the job should specify an environment that supports Docker, typically a Linux environment (e.g., ubuntu-latest), since Docker is widely supported and commonly used in Linux-based environments.
NEW QUESTION # 33
In which locations can actions be referenced by workflows? (Choose three.)
- A. a published Docker container image on Docker Hub
- B. a public NPM registry
- C. the repository's Secrets settings page
- D. an .action extension file in the repository
- E. a separate public repository
- F. the runs-on: keyword of a workflow file
- G. the same repository as the workflow
Answer: A,E,G
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 # 34
Which run: command will set a step's output?
- A. run: export MY_OUTPUT=foo
- B. run: echo "MY_OUTPUT=foo" >> $GITHUB_OUTPUT
- C. run: echo "::set-env name=MY OUTPUT::foo"
- D. run: echo ${{ $GITHUB_OUTPUT=foo }}
Answer: B
Explanation:
The $GITHUB_OUTPUT file is used to pass data from one step to another in GitHub Actions. The echo command appends the key-value pair to this file, which sets the output variable (MY_OUTPUT) for the current step.
NEW QUESTION # 35
As a developer, you need to make sure that only actions from trusted sources are available for use in your GitHub Enterprise Cloud organization. Which of the following statements are true? (Choose three.)
- A. Actions can be restricted to only those available in the enterprise.
- B. Specific actions can individually be enabled for the organization, including version information.
- C. Individual third-party actions enabled with a specific tag will prevent updated versions of the action from introducing vulnerabilities.
- D. GitHub-verified actions can be collectively enabled for use in the enterprise.
- E. Actions can be published to an internal marketplace.
- F. Actions created by GitHub are automatically enabled and cannot be disabled.
Answer: B,D,E
Explanation:
You can enable specific actions for the organization by identifying them and providing version control, ensuring only trusted versions are used in workflows.
GitHub-verified actions can be enabled at the enterprise level, providing an extra layer of security by ensuring that only trusted actions are available to workflows.
Actions can be published to an internal marketplace, allowing organizations to share reusable actions securely within their enterprise without exposing them to the public.
NEW QUESTION # 36
A development team has been using a Powershell script to compile and package their solution using existing tools on a Linux VM, which has been configured as a self-hosted runner. They would like to use the script as- is in an automated workflow. Which of the following should they do to invoke their script within a workflow step?
- A. Use the YAML powershell: step.
- B. Run the pwsh2bash command to convert the script so it can be run on Linux.
- C. Use the YAML shell: pwsh in a run step.
- D. Configure a self-hosted runner on Windows with the requested tools.
- E. Use the actions/run-powershell action to invoke the script.
Answer: C
Explanation:
Since the self-hosted runner is configured on a Linux VM and the script is written in PowerShell, you can invoke the script using the pwsh (PowerShell Core) shell in a run step in the workflow. This ensures that the script runs as-is on the Linux runner, as PowerShell Core (pwsh) is cross-platform and supports Linux.
NEW QUESTION # 37
Which files are required for a Docker container action in addition to the source code? (Choose two.)
- A. metadata.yml
- B. Actionfile
- C. action.yml
- D. Dockerfile
Answer: C,D
Explanation:
Dockerfile: TheDockerfileis required for Docker container actions. It defines the environment for the action, specifying the base image, dependencies, and any commands to set up the action's runtime inside the container.
action.yml: Theaction.ymlfile is required for all GitHub Actions, including Docker container actions. It contains metadata about the action, including the inputs, outputs, and the runtime environment (which in this case is Docker, defined underruns.using).
NEW QUESTION # 38
Which choices represent best practices for publishing actions so that they can be consumed reliably? (Choose two.)
- A. repo name
- B. commit SHA
- C. default branch
- D. organization name
- 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 # 39
As a developer, how can you identify a Docker container action on GitHub?
- A. The action.yml metadata file references a Dockerfile file.
- B. The action's repository includes @actions/core in the root directory.
- C. The action's repository name includes the keyword "Docker."
- D. The action.yml metadata file has the runs.using value set to Docker.
Answer: D
Explanation:
In a Docker container action, theaction.ymlfile includes theruns.usingfield, which is set todockerto specify that the action runs inside a Docker container. This is the key indicator that the action is a Docker container action.
NEW QUESTION # 40
What menu options in a repository do you need to select in order to use a starter workflow that is provided by your organization?
- A. Actions > Load workflow
- B. Workflow > New workflow
- C. Actions > New workflow
- D. Workflow > Load workflow
Answer: C
Explanation:
To use a starter workflow provided by your organization, you need to go to the Actions tab in the repository and select New workflow. This option allows you to either create a new workflow or select from a list of available workflow templates, including starter workflows provided by your organization.
NEW QUESTION # 41
Which scopes are available to define custom environment variables within a workflow file? (Choose three.)
- A. a specific step within a job, by using jobs.<job_id>.steps[*].env
- B. the entire stage, by using env at the top of the defined build stage
- C. within the run attribute of a job step
- D. the contents of a job within a workflow, by using jobs.<job_id>.env
- E. all jobs being run on a single Actions runner, by using runner.env at the top of the workflow file
- F. the entire workflow, by using env at the top level of the workflow file
Answer: A,C,F
Explanation:
You can define environment variables for the entire workflow by using the env key at the top level of the workflow file. These environment variables will be available to all jobs and steps within the workflow.
Environment variables can also be set within the run attribute of a job step, and these variables will be scoped only to that specific step.
You can set environment variables for specific steps within a job by using jobs.<job_id>.steps[*].env, which allows you to define variables that will only be available to that step.
NEW QUESTION # 42
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. passing the GITHUB_TOKEN secret to an action that requires a token as an input
- C. checking out source code with the actions/checkout@v3 action
- D. assigning non-default permissions to the GITHUB_TOKEN
Answer: A,B
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 # 43
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 artifacts to access theGitHub Package Registry and download a package for a workflow
- C. Use caching to store cache entries for up to 30 days between accesses.
- D. Use cachingwhen reusing files that change rarely between jobs or workflow runs.
Answer: A,D
NEW QUESTION # 44
When reviewing an action for use, what file defines its available inputs and outputs?
- A. workflow.yml
- B. defaults.json
- C. config.json
- D. action.yml
- E. inputs.yml
Answer: D
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 # 45
Scheduled workflows run on the:
- A. latest commit on the default or base branch
- B. specified commit and branch from the workflow YAML file,
- C. latest commit from the branch named main,
- D. latest commit from the branch named schedule,
- E. latest commit and branch on which the workflow was triggered,
Answer: E
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 # 46
You need to create new workflows to deploy to an unfamiliar cloud provider. What is the fastest and safest way to begin?
- A. Search GitHub Marketplace for verified actions published by the cloud provider.
- B. Create a custom action to wrap the cloud provider's CLI.
- C. Download the CLI for the cloud provider and review the associated documentation.
- D. Search GitHub Marketplace for actions created by GitHub.
- E. Use the actions/jenkins-plugin action to utilize an existing Jenkins plugin for the cloud provider.
Answer: A
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 # 47
You have exactly one Windows x64 self-hosted runner, and it is configured with custom tools. Which syntax could you use in the workflow to target that 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
Explanation:
The runs-on keyword allows you to specify the operating system and other labels for the runner. By specifying self-hosted, windows, and x64, you are targeting a self-hosted Windows runner that matches these criteria, which aligns with the custom configuration of your self-hosted runner.
NEW QUESTION # 48
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 artifacts to access theGitHub Package Registry and download a package for a workflow
- C. Use caching to store cache entries for up to 30 days between accesses.
- D. Use cachingwhen reusing files that change rarely between jobs or workflow runs.
Answer: A,D
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 # 49
......
Dumps Brief Outline Of The GitHub-Actions Exam: https://getfreedumps.passreview.com/GitHub-Actions-exam-questions.html