GitHub-Actions
GitHub-Actions
GitHub-Actions
GitHub Actions
QUESTION & ANSWERS
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
QUESTION: 1
Upon inspection of a workflow, you notice that multiple steps set the bash shell. How can you unify the shell
definition across multiple steps without having to redefine it per step individually?
Option B : You should run the command inside of a container if you need a specific shell.
Correct Answer: C
Explanation/Reference:
Use defaults to create a map of default settings that will apply to all jobs in the workflow. You can also set default settings that
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#defaults
QUESTION: 2
Option A : latest commit and branch on which the workflow was triggered
Option B : latest commit from the branch named schedule,
Option C : latest commit from the branch named main,
Option D : specified commit and branch from the workflow YAML file,
Option E : latest commit on the default or base branch
Correct Answer: A
Explanation/Reference:
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
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
QUESTION: 3
Correct Answer: C
Explanation/Reference:
Avoiding building a Docker container at the time of executing the custom action. It will help with prevent security risks. The
https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action
https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-docker-container-actions
QUESTION: 4
True or false? You are working with an existing GitLab CI/CD pipeline. Can you migrate the pipeline to GitHub
Actions in an automated fashion?
Option A : True
Option B : False
Correct Answer: A
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
Explanation/Reference:
You can use GitHub Actions Importer to plan and automatically migrate your CI/CD pipelines to GitHub Actions from Azure
GitHub Actions Importer is distributed as a Docker container, and uses a GitHub CLI extension to interact with the container.
Any workflow that is converted by the GitHub Actions Importer should be inspected for correctness before using it as a
production workload. The goal is to achieve an 80% conversion rate for every workflow, however, the actual conversion rate
https://docs.github.com/en/actions/migrating-to-github-actions/automated-migrations/automating-migration-with-github-
actions-importer
QUESTION: 5
How can you determine the outcome of a workflow run, such as whether it succeeded or failed? (choose two)
Explanation/Reference:
A status badge shows whether a workflow is currently failing or passing. A common place to add a status badge is in the
README.md file of your repository, but you can add it to any web page you'd like.
https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/adding-a-workflow-status-badge
Every workflow run generates a real-time graph that illustrates the run progress. You can use this graph to monitor and debug
workflows.
https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/using-the-visualization-graph
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
QUESTION: 6
What is the primary purpose of the run_number property in the github context?
Correct Answer: A
Explanation/Reference:
The github.run_number property is a unique number for each run of a particular workflow in a repository. This number begins
at 1 for the workflow's first run, and increments with each new run. This number does not change if you re-run the workflow
run.
https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
QUESTION: 7
As a developer, you have a 10-MB data set that is required in a specific workflow. Which steps should you
perform so the dataset is stored encrypted and can be decrypted during the workflow? (Choose three.)
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
Explanation/Reference:
First, the dataset should be encrypted before being stored. This ensures that the data is protected when stored in a repository.
The encrypted dataset can be stored in a GitHub secret, ensuring it is securely kept and not exposed publicly. The encryption
key needed to decrypt the dataset should also be stored in a GitHub secret to maintain security during the workflow, allowing
QUESTION: 8
What is the minimal syntax for declaring an output named foo for an action?
Option A :
Option B :
Option C :
Option D :
Correct Answer: C
Explanation/Reference:
The correct minimal syntax for declaring an output in GitHub Actions is by using the foo key under outputs, and associating it
with a value (in this case, Some value). This is the simplest form to define an output in a workflow or action.
QUESTION: 9
Which of the following scenarios requires a developer to explicitly use the GITHUB_TOKEN or github.token
secret within a workflow? (Choose two.)
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
Option A : passing the GITHUB_TOKEN secret to an action that requires a token as an input
Option B : making an authenticated GitHub API request
Option C : checking out source code with the actions/checkout@v3 action
Option D : assigning non-default permissions to the GITHUB_TOKEN
Explanation/Reference:
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.
QUESTION: 10
A JavaScript custom action needs to log an error, as shown below. Select the correct code for logging the
error using the core package and failing the action.
try {
} catch (error) {
____
Correct Answer: C
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
Explanation/Reference:
You should use core.setFailed to set the failing exit code for your action.
https://github.com/actions/toolkit/tree/main/packages/core#exit-codes https://docs.github.com/en/actions/creating-
actions/creating-a-javascript-action
QUESTION: 11
Correct Answer: B
Explanation/Reference:
There are only three attributes that need to be defined at a minimum in a custom action's metadata file: name, description,
runs.
https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions
https://learn.microsoft.com/en-us/training/modules/create-custom-github-actions/create-custom-github-action
QUESTION: 12
As a developer, your self-hosted runner sometimes looses connection while running jobs. How should you
troubleshoot the issue affecting your self-hosted runner?
Option A :
Set the DEBUG environment variable to true before starting the self-hosted runner to produce more
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
verbose console output.
Option B : Locate the self-hosted runner in your repository's settings page and download its log archive.
Option C : Access the self-hosted runner's installation directory and look for log files in the _diag folder.
Option D : Start the self-hosted runner with the --debug flag to produce more verbose console output.
Correct Answer: C
Explanation/Reference:
When troubleshooting a self-hosted runner, you can access the _diag folder located in the selfhosted runner's installation
directory. This folder contains diagnostic logs that can help you identify the root cause of issues, such as connection problems.
QUESTION: 13
Select all features associated with the tool Dependabot. (choose three)
Explanation/Reference:
Dependabot raises pull requests to update dependencies. Depending on how your repository is configured, Dependabot may
raise pull requests for version updates and/or for security updates.
Dependabot is able to trigger GitHub Actions workflows on its pull requests and comments; however, certain events are treated
differently.
For workflows initiated by Dependabot (github.actor == 'dependabot[bot]') using the pull_request, pull_request_review,
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
pull_request_review_comment, push, create, deployment, and deployment_status events, the following restrictions apply:
• Secrets are populated from Dependabot secrets. GitHub Actions secrets are not available.
• For workflows initiated by Dependabot (github.actor == 'dependabot[bot]') using the pull_request_target event, if the base
ref of the pull request was created by Dependabot (github.actor == 'dependabot[bot]'), the GITHUB_TOKEN will be read-only
https://docs.github.com/en/code-security/dependabot/working-with-dependabot/managing-pull-requests-for-dependency-
updates
https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions
QUESTION: 14
Select the valid expression for referencing a matrix variable given the workflow below.
1. jobs:
2. example_matrix:
3. strategy:
4. matrix:
Option A : $matrix.version
Correct Answer: D
Explanation/Reference:
A job will run for each possible combination of the variables. In this example, the workflow will run six jobs, one for each
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
combination of the os and version variables.
The variables that you define become properties in the matrix context, and you can reference the property in other areas of
your workflow file. In this example, you can use matrix.version and matrix.os to access the current value of version and os that
https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
QUESTION: 15
True or false? The GitHub Actions visualization graph represents each job as a node.
Option A : True
Option B : False
Correct Answer: A
Explanation/Reference:
The graph displays each job in the workflow. An icon to the left of the job name indicates the status of the job. Lines between
https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/using-the-visualization-graph
QUESTION: 16
Select all correct statements about the step definition below. (choose two)
1. steps:
2. - run: |
3. echo "::group::Process"
4. echo "Starting"
6. echo "::endgroup::"
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
Option A : Renders a expandable group in the log with the title "Process".
Explanation/Reference:
To create a group, use the group command and specify a title. Anything you print to the log between the group and endgroup
https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines
QUESTION: 17
Option A : In the .github/workflow-templates directory of the repository that wants to use it.
Option B : In the UI of the GitHub organization under Settings > Workflow Templates.
Option C : In a repository named workflow-templates owned by your organization.
Correct Answer: D
Explanation/Reference:
Workflow templates are defined in a .github repository, enabling you to leverage all the power of GitHub’s collaborative
capabilities and providing full auditability. Workflow files need to reside in the workflow-templates directory.
https://docs.github.com/en/actions/using-workflows/creating-starter-workflows-for-your-organization
https://github.blog/changelog/2020-06-23-github-actions-workflow-templates/
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
QUESTION: 18
Correct Answer: A
Explanation/Reference:
If you specify an array of strings or variables, your workflow will execute on any runner that matches all of the specified runs-
on values. For example, here the job will only run on a self-hosted runner that has the labels linux, x64, and gpu:
QUESTION: 19
Select the context variable returning the user that triggered the workflow.
Option A : github.user
Option B : workflow.trigger
Option C : github.username
Option D : github.actor
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
Correct Answer: D
Explanation/Reference:
github.actor is the username of the user that triggered the initial workflow run. If the workflow run is a re-run, this value may
differ from github.triggering_actor. Any workflow re-runs will use the privileges of github.actor, even if the actor initiating the
https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
QUESTION: 20
True or false? Compared to a Github-hosted runner, a self-hosted runner needs to provide a clean instance
for every job execution.
Option A : False
Option B : True
Correct Answer: A
Explanation/Reference:
GitHub-hosted runners provide a clean instance for every job execution. Self-hosted runners don't need to have a clean
https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-
runners#differences-between-github-hosted-and-self-hosted-runners
QUESTION: 21
Select all common characteristics of an action available on the GitHub marketplace. (choose three)
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
Option C : The source code repository hosting the action does not define any tags.
Explanation/Reference:
Actions are published to GitHub Marketplace immediately and aren't reviewed by GitHub as long as they meet these
requirements:
• The action's metadata file (action.yml or action.yaml) must be in the root directory of the repository.
https://docs.github.com/en/actions/creating-actions/publishing-actions-in-github-marketplace
QUESTION: 22
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?
Correct Answer: D
Explanation/Reference:
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
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
PowerShell Core (pwsh) is cross-platform and supports Linux.
QUESTION: 23
Tom is implementing a custom action that uses a template engine to replace placeholders with actual
values. Select all correct statements about the action's action.yml file. (choose two)
Option B : The action defines a template file and 0..n placeholder values as inputs.
Option C : The action should be implemented as composite action as it needs to ingest input values.
Option D : The output is a copy of the template file with its placeholder values replaced by the end user-
provided values.
Explanation/Reference:
The action.yml defines inputs and outputs. You can choose to implement the action with any of the available action types,
though an implementation in JavaScript will likely lead to the best maintainable solution long-term.
https://docs.github.com/en/actions/creating-actions/about-custom-actions
https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions
QUESTION: 24
Which workflow command would output the debug message "action successfully debugged"?
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
Correct Answer: C
Explanation/Reference:
The ::debug:: syntax is used to output debug messages in GitHub Actions workflows. This command will print the message
"action successfully debugged" in the debug logs when the workflow runs.
QUESTION: 25
How does GitHub Actions render a matrix-based workflow run as visual representation in the UI?
Option A : A table representation with the different axis in the form of column and row.
Option B : One box per job in a single column to indicate parallelism.
Correct Answer: D
Explanation/Reference:
A matrix-based workflow renders all jobs in a single box. You can find an example below.
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
QUESTION: 26
Option B : categories
Option C : labels
Option D : groups
Correct Answer: A
Explanation/Reference:
• a single string
When you combine groups and labels, the runner must meet both requirements to be eligible to run the job.
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-runners-in-a-group
QUESTION: 27
True or false? Can you use a different file name than action.yaml or action.yml for implementing a custom
action?
Option A : False
Option B : True
Correct Answer: A
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
Explanation/Reference:
All actions require a metadata file. The metadata filename must be either action.yml or action.yaml. The data in the metadata
file defines the inputs, outputs, and runs configuration for your action.
https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions
QUESTION: 28
True or false? When referring to the latest label of a runner, can the image include alpha, beta, or rc
versions?
Option A : True
Option B : False
Correct Answer: B
Explanation/Reference:
The -latest runner images are the latest stable images that GitHub provides, and might not be the most recent version of the
Beta and Deprecated Images are provided "as-is", "with all faults" and "as available" and are excluded from the service level
agreement and warranty. Beta Images may not be covered by customer support.
https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-
runners#supported-runners-and-hardware-resources
QUESTION: 29
A workflow file checked into Git defines a step to deploy an application to Heroku. What's the issue with this
workflow?
1. jobs:
2. build:
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
3. runs-on: ubuntu-latest
4. steps:
5. - uses: actions/checkout@v2
6. - uses: akhileshns/[email protected]
7. with:
8. heroku_api_key: "985656eabf5ca98a17caae78c8858e88f2616214"
9. heroku_app_name: "my-app"
Option D : The action should use v3 instead of v3.13.15 similar to the checkout action.
Option E : The API key should be defined as a secret and consumed as such.
Correct Answer: E
Explanation/Reference:
The main concern about this workflow is use of a plain-text API key. Anyone with access to the workflow file or the repository
containing the file will have access to the Heroku account. This poposes a huge security risk. Instead of using a plain-text
value, define a secret for it and consume it from the workflow. A value could look as such: ${{secrets.HEROKU_API_KEY}}.
https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions
QUESTION: 30
True or false? A workflow template offers the ability to inject end user values for placeholders to make the
functionality configurable.
Option A : True
Option B : False
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
Correct Answer: B
Explanation/Reference:
Starter workflows allow everyone in your organization who has permission to create workflows to do so more quickly and
easily. You can use built-in variable and refer to secrets but there's no feature that let's you define variable values when you
use a template.
https://docs.github.com/en/actions/using-workflows/creating-starter-workflows-for-your-organization
https://docs.github.com/en/actions/learn-github-actions/using-starter-workflows
QUESTION: 31
You want to publish a JAR file to a Maven repository via GitHub Packages. Which permission do you need?
Correct Answer: C
Explanation/Reference:
The packages: write permission permits an action to publish packages on GitHub Packages.
https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs#overview
https://docs.github.com/en/packages/learn-github-packages/about-permissions-for-github-packages#about-scopes-and-
permissions-for-package-registries
QUESTION: 32
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
How do you publish an initial release of a custom action to the GitHub marketplace?
Option B : The marketplace automatically publishes actions available in a public repository by searching
for the file action.yml.
Option C : Select "Publish this Action to the GitHub Marketplace" from the repository UI.
Correct Answer: C
Explanation/Reference:
• Navigate to the action metadata file in your repository (action.yml or action.yaml), and you'll see a banner to publish the
• Under "Release Action", select Publish this Action to the GitHub Marketplace.
https://docs.github.com/en/actions/creating-actions/publishing-actions-in-github-marketplace#publishing-an-action
QUESTION: 33
Option A : team
Option B : organization
Option C : enterprise
Option D : workflow
Option E : repository
Option F : environment
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
Explanation/Reference:
Sensitive values should never be stored as plaintext in workflow files, but rather as secrets. Secrets can be configured at the
organization, repository, or environment level, and allow you to store sensitive information in GitHub.
https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-secrets
QUESTION: 34
How can you enable users to customize the behavior of your custom action by providing optional settings?
Correct Answer: B
Explanation/Reference:
To enable users to customize the behavior of your custom action by providing optional settings, you can define additional
https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputsinput_iddefault
QUESTION: 35
What's the behavior of a workflow run waiting for approval? (choose two)
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
Option D : The run will fail if rejected by the reviewer.
Explanation/Reference:
Jobs that reference an environment configured with required reviewers will wait for an approval before starting. While a job is
awaiting approval, it has a status of "Waiting". If a job is not approved within 30 days, it will automatically fail.
To approve the job, click Approve and deploy. Once a job is approved (and any other deployment protection rules have
passed), the job will proceed. At this point, the job can access any secrets stored in the environment. To reject the job, click
https://docs.github.com/en/actions/managing-workflow-runs/reviewing-deployments
QUESTION: 36
You want to convert all of your existing CI/CD pipelines running on third-party products to GitHub Actions
workflows. To automate the process you are planning to use the "actions importer extension". How do you
install it?
Option A : Automatic conversion of a Jenkinsfile to GitHub Actions workflow is currently not available as a
feature.
Correct Answer: D
Explanation/Reference:
The command gh extension install github/gh-actions-importer installs the GitHub Actions Importer CLI extension.
https://docs.github.com/en/actions/migrating-to-github-actions/automated-migrations/automating-migration-with-github-
actions-importer#installing-the-github-actions-importer-cli-extension
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
https://cli.github.com/manual/gh_extension_install
QUESTION: 37
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.)
Option A : Use caching when reusing files that change rarely between jobs or workflow runs.
Option B : Use artifacts when referencing files produced by a job after a workflow has ended.
Option C : Use caching to store cache entries for up to 30 days between accesses.
Option D : Use artifacts to access the GitHub Package Registry and download a package for a workflow
Explanation/Reference:
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.
https://www.genuinedumps.com/GitHub-Actions-exam-questions.html