0% found this document useful (0 votes)
17 views

GitHub-Actions

The document contains a series of questions and answers related to GitHub Actions, covering topics such as workflow configuration, scheduled workflows, Docker custom actions, and troubleshooting self-hosted runners. Each question is followed by multiple-choice options, with the correct answers and explanations provided. The content serves as a study guide for individuals preparing for GitHub Actions-related exams or certifications.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

GitHub-Actions

The document contains a series of questions and answers related to GitHub Actions, covering topics such as workflow configuration, scheduled workflows, Docker custom actions, and troubleshooting self-hosted runners. Each question is followed by multiple-choice options, with the correct answers and explanations provided. The content serves as a study guide for individuals preparing for GitHub Actions-related exams or certifications.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

GitHub

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 A : There's no way to define a common shell as part of a workflow.

Option B : You should run the command inside of a container if you need a specific shell.

Option C : Define the common shell with the defaults attribute.

Option D : The shell is always determined by the selected runner.

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

are only available to a job.

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#defaults

QUESTION: 2

A Scheduled workflows run on the:

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

the scheduled event occurs.

https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
QUESTION: 3

What's the recommended approach for implementing a Docker custom action?

Option A : You cannot execute a custom action in a Docker container.

Option B : By providing the instructions in a Dockerfile.

Option C : By pointing to a prebuilt Docker container.

Option D : By using a shell command instead.

Option E : By building the Docker container on-the-fly.

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

better approach is to assign a prebuilt image from a private registry.

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

DevOps, CircleCI, GitLab, Jenkins, and Travis CI.

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

will depend on the makeup of each individual pipeline that is converted.

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)

Option A : By checking the status badges associated with the workflow.

Option B : The outcome is sent via a direct message on GitHub.

Option C : The outcome is shown in the repository's "Issues" tab.


Option D : By examining the "Status" value in the workflow user interface.

Correct Answer: A,D

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?

Option A : To identify the workflow run's position in the workflow history.

Option B : To manually start a workflow using the GitHub UI.

Option C : To specify the runner for a workflow.

Option D : To retrieve the workflow's name.

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.)

Option A : Encrypt the dataset.


Option B : Leverage the actions/download-secret action in the workflow.
Option C : Store the dataset in a GitHub encrypted secret.
Option D : Store the encryption keys in a GitHub encrypted secret.
Option E : Compress the dataset
Option F : Commit the encrypted dataset to the same repository as the workflow
Option G : Create a GitHub encrypted secret with the Large object option selected and upload the
dataset.

Correct Answer: A,C,D

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

access only when needed.

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

Correct Answer: A,B

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.

const core = require('@actions/core');

try {

// Execute custom action logic

} catch (error) {

// Log an error and fail action

____

Option A : core.failAction(`Action failed with error ${err}`);

Option B : core.fail(`Action failed with error ${err}`);

Option C : core.setFailed(`Action failed with error ${err}`);

Option D : core.error(`Error ${err}`);

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

Which of the following attributes are mandatory in an action.yml file?

Option A : name, description, type


Option B : name, description, runs

Option C : name, description, author, branding

Option D : name, inputs, outputs, runs

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)

Option A : Checking dependencies for updates and security vulnerabilities.

Option B : Finding plain-text credentials in a workflow file.

Option C : Scanning runners for security vulnerabilities.

Option D : Preventing the use of GITHUB_TOKEN in a workflow file.

Option E : Triggering a workflow with github.actor == 'dependabot[bot]'.

Option F : Opening a pull request with an updated version of a dependency.

Correct Answer: A,E,F

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:

• GITHUB_TOKEN has read-only permissions by default.

• 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

and secrets are not available.

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:

5. os: [ubuntu-22.04, ubuntu-20.04]

6. version: [10, 12, 14]

Option A : $matrix.version

Option B : ${{ matrix.os[0] }}

Option C : ${{ jobs.example_matrix.version }}

Option D : ${{ matrix.os }}

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

the job is using.

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

jobs indicate dependencies.

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"

5. echo "Cleaning up"

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".

Option B : The syntax is invalid.

Option C : Fails the workflow run.

Option D : Groups the messages "Starting" and "Cleaning up".

Option E : Renders 4 messages to standard output.

Correct Answer: A,D

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

commands is nested inside an expandable entry in the log.

https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines

QUESTION: 17

Where do you create a workflow template to make it available to your organization?

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.

Option D : In the workflow-templates of the .github repository 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

A job defines the following configuration:

runs-on: [self-hosted, linux, x64, gpu]

Which runner is chosen to execute the workflow?

Option A : Only on a runner that matches all values.

Option B : On all runners that match at least one value.

Option C : On any runner available.

Option D : On a Linux-based GitHub-hosted runner.

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:

runs-on: [self-hosted, linux, x64, 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

re-run (github.triggering_actor) has different privileges.

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

instance for every job execution.

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)

Option A : The action uses Docker to run the logic.

Option B : The action provides a unique name.

https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
Option C : The source code repository hosting the action does not define any tags.

Option D : The source code of the action is hosted on a GitHub repository.

Option E : The action provides an action.yml or action.yaml file.

Correct Answer: B,D,E

Explanation/Reference:

Actions are published to GitHub Marketplace immediately and aren't reviewed by GitHub as long as they meet these

requirements:

• The action must be in a public repository.

• Each repository must contain a single action.

• Each repository must not contain any workflow files.

• 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?

Option A : Configure a self-hosted runner on Windows with the requested tools.


Option B : Use the YAML powershell: step.
Option C : Run the pwsh2bash command to convert the script so it can be run on Linux.
Option D : Use the YAML shell: pwsh in a run step.
Option E : Use the actions/run-powershell action to invoke the script.

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 A : The action does not need to define outputs.

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.

Option E : The logic of the action needs to be embedded in a Docker container.

Option F : The action can only be implemented in JavaScript.

Correct Answer: B,D

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"?

Option A : echo :debug::message=action successfully debugged"


Option B : echo "debug-action successfully debugged"
Option C : echo "::debug::action successfully debugged"
Option D : echo ":debug: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.

Option C : One box with one nested box per job.

Option D : One box for all jobs.

Option E : One box per job connected by an directional arrow sequentially.

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

The runs-on attribute can select runners by ____.

Option A : labels and groups

Option B : categories
Option C : labels

Option D : groups

Correct Answer: A

Explanation/Reference:

You can provide runs-on as:

• a single string

• a single variable containing a string

• an array of strings, variables containing strings, or a combination of both

• a key: value pair using the group or label keys

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

operating system available from the operating system vendor.

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"

10. heroku_email: "[email protected]"

Option A : There's no issue with the code.


Option B : The Heroku application name should not be spelled out in plain-text for security reasons.
Option C : This workflow can only be executed on the latest Ubuntu image and therefore the action may
become incompatible.

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?

Option A : id-token: write

Option B : deployments: read

Option C : packages: write

Option D : actions: write

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 A : By executing the github-marketplace-releaser tool.

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.

Option D : Request a release on the GitHub marketplace UI.


Option E : Push a tag to the repository.

Correct Answer: C

Explanation/Reference:

• On GitHub.com, navigate to the main page of the repository.

• Navigate to the action metadata file in your repository (action.yml or action.yaml), and you'll see a banner to publish the

action to GitHub Marketplace. Click Draft a release.

• 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

Secrets can be configured on a(n) ___-level. (choose three)

Option A : team

Option B : organization

Option C : enterprise

Option D : workflow

Option E : repository

Option F : environment

Correct Answer: B,E,F

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?

Option A : Allow users to modify the action's Dockerfile.

Option B : Define additional inputs with default values.

Option C : Optional settings are not supported in custom actions.

Option D : Use the optional property in the action.yml file.

Correct Answer: B

Explanation/Reference:

To enable users to customize the behavior of your custom action by providing optional settings, you can define additional

inputs in the action.yml file with default values.

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)

Option A : The run will never fail.

Option B : The status is set to "Waiting".

Option C : The run will automatically fail after 7 days.

https://www.genuinedumps.com/GitHub-Actions-exam-questions.html
Option D : The run will fail if rejected by the reviewer.

Correct Answer: B,D

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

Reject. If a job is rejected, the workflow will fail.

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.

Option B : By running the github-actions install extension command.

Option C : The extension is available with the gh tool by default.


Option D : By running the gh extension install command.

Option E : An extension with this name does not exist.

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

Correct Answer: A,B

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

You might also like