GitHub Actions Workflow: A Comprehensive Q&A Guide, Exams of Advanced Education

A structured question-and-answer format to help users understand github actions workflows. it covers key concepts such as workflow syntax, events, jobs, steps, actions, and more, making it an excellent resource for learning about this powerful ci/cd tool. The q&a format facilitates understanding and retention of complex information.

Typology: Exams

2024/2025

Available from 05/05/2025

Smartsolutions
Smartsolutions 🇺🇸

3

(4)

18K documents

1 / 17

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Github Actions Test With
Complete Solution
The Workflow Syntax is written in? - ANSWER YAML
The Workflow Syntax must have what file extensions? - ANSWER .yml or
.yaml
The Workflow is stored in what directory? - ANSWER .github/workflows/
Each different YAML file corresponds to what? - ANSWER A different
workflow.
Where is the Workflow's name displayed? - ANSWER In the repository's
actions page
What is the Workflow, Job, or Step ENV? - ANSWER A map of environment
variables that are available within each Workflow.
What is the On Event used for? - ANSWER The event type that triggers the
Workflow.
How can you provide arguments to the On Event in your Workflow? -
ANSWER As a single event string, an array of events, or a configuration map
that restricts the execution of a workflow.
With regards to the On Event, Paths specify what? - ANSWER Specify which
files must have been modified in order to run a workflow.
With regards to the On Event, if your rules are made up of only exclusions,
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download GitHub Actions Workflow: A Comprehensive Q&A Guide and more Exams Advanced Education in PDF only on Docsity!

Github Actions Test With

Complete Solution

The Workflow Syntax is written in? - ANSWER YAML

The Workflow Syntax must have what file extensions? - ANSWER .yml or .yaml

The Workflow is stored in what directory? - ANSWER .github/workflows/

Each different YAML file corresponds to what? - ANSWER A different workflow.

Where is the Workflow's name displayed? - ANSWER In the repository's actions page

What is the Workflow, Job, or Step ENV? - ANSWER A map of environment variables that are available within each Workflow.

What is the On Event used for? - ANSWER The event type that triggers the Workflow.

How can you provide arguments to the On Event in your Workflow? - ANSWER As a single event string, an array of events, or a configuration map that restricts the execution of a workflow.

With regards to the On Event, Paths specify what? - ANSWER Specify which files must have been modified in order to run a workflow.

With regards to the On Event, if your rules are made up of only exclusions,

you can use what keywords? - ANSWER Branches-ignore, tags-ignore, and paths-ignore.

With regards to the On Event, what keyword forms cannot be mixed. - ANSWER The "-ignore' form and the inclusive version.

With regards to the On Event, what types of keywords allow us to narrow down activities? - ANSWER Opened, Created, Edited, etc...

A workflow is made up of one or more...? - ANSWER One or more Jobs

Jobs are identified by what? - ANSWER A unique Job ID or name. Starts with a letter or underscore.

How do jobs run as a default? - ANSWER Jobs run in parallel

Where does each job run? - ANSWER Each job runs in a fresh instance specified by runs-on.

What is the Job Name used for? - ANSWER It's the name displayed on GitHub.

containers on the same network with the same volume mounts.

This Container object has what attributes? - ANSWER Image, Env, Ports, Volume, and Options.

The Container command can be used instead of what? - ANSWER This command can be used instead of runs-on.

What is the maximum number of minutes to let a workflow run before GitHub automatically cancels it? - ANSWER These can run for a max of 360 Minutes or 6 hours

What are services under each job step? - ANSWER These are additional support containers for a job in a workflow. I.e cache services or databases.

How are services managed in GitHub? - ANSWER The runner on the VM will automatically create a network and manage the lifecycle of the service containers.

Each service object receive the same parameters as what other object? - ANSWER The same as the container object.

A job contains a sequence of tasks called what? - ANSWER Steps

What can Job steps run? - ANSWER These can run commands, set up tasks, or an action from a repository or docker registry.

Where does each step run? - ANSWER This runs in it's own fresh virtual environment

What does each step have access to? - ANSWER This has access to the workspace and file system.

What is the Step Name used for? - ANSWER This is used as a lable to be displayed for this step in GitHub.

Is the Step Name required? - ANSWER This name is not required.

What does the "uses" command do? - ANSWER This specifies an action to run as part of a step in the job.

What sort of actions can be used with the "uses" command? - ANSWER We can use actions in the same repository as the workflow, a public repo, or a published docker image.

"With" keyword

What is the "with" keyword? - ANSWER A map of input parameters defined by the action in it's action.yaml file.

When an action is container based, what are the special parameter names? - ANSWER Args and Entrypoint

What is the use of the "args" parameter under container based actions? - ANSWER This is a string that defines the inputs passed to a Docker containers Entrypoint. Used in place of the CMD instruction in a Dockerfile.

What is the use of the "entrypoint" parameter under container based actions? - ANSWER This is a string that defines or overrides the executable to run as the Docker containers Entrypoint.

What is the "if" keyword used for? - ANSWER This prevents a step from running unless a condition is met.

What is the "run" keyword used for? - ANSWER This can be used to run a command line program using the OS shell.

What does each "run" command represent? - ANSWER This represents a new process and shell in the virtual environment.

How can we select a specific shell to use with the "run" command? - ANSWER We can use the "shell" attribute to designate a specific shell.

How to we run multiple commands in a single shell instance? - ANSWER Commands can be run in a singel shell instance using the | {pipe} operator.

What is a Job "strategy"? - ANSWER A set of different configurations of the virtual environment. The job's set of steps will be executed on each of these configurations.

runs-on: ${{ matrix.os }}

strategy:

matrix: os: [ubuntu-16.04, ubuntu-18.04] node: [6, 8, 10]

steps:

  • uses: actions/setup-node@v with:

What are contexts? - ANSWER Objects providing access to runtime information.

What are some context objects? - ANSWER github, job, steps, runner, secrets, strategy and matrix.

What is an artifact? - ANSWER This is a file or collection of files produced during a workflow run that can be stored and shared between jobs in a workflow run.

How can we manipulate artifacts in GitHub? - ANSWER Use actions actions/upload-artifact and actions/download-artifact

What parameters can be used to manipulate artifacts? - ANSWER The parameters "name" and "path" can be used to manupulate these.

How long do artifacts stick around? - ANSWER These stick around for 90 days.

What action can be used for dependencies and other commonly reused files across runs? - ANSWER With action "action/cache"

What parameters are used for "action/cache" - ANSWER Key, Path, and restore-keys

With "action/cache" what is the key parameter used for? - ANSWER This is used to save and search for a cache.

With "action/cache" what is the path parameter used for? - ANSWER The file path (absolute or relative to the working directory) on the runner to cache or restore.

With "action/cache" what is the restore-key parameter used for? - ANSWER An optional keyword. An ordered list of alternative keys to use for finding the cache if no cache hit occurred for key.

One repo can contain how many workflows? - ANSWER This can contain many different workflows.

What are Workflows? - ANSWER Defines events that trigger executions of actions.

How many actions can be contained in a repo? - ANSWER One repo can

env.VARIABLE_NAME }}

How are secrets stored? - ANSWER These are stored as encrypted values in the GitHub repo settings.

How can we use secrets in a job? - ANSWER These must be explicitly passed into the job.

What is the syntax for using secrets? - ANSWER ${{ secrets.SECRET_KEY }}

How do we add Secrets to GitHub? - ANSWER Settings > Secrets

What are 5 requirements for Custom Actions? - ANSWER Objective

Repo

Dockerfile

Action.yaml Metadata

Readme.md

What is the objective for a Custom GitHub Action? - ANSWER Thinking about what problems can be solved and can this be parameterized.

What is the repo used for with Custom Actions? - ANSWER This helps with managing and versioning Custom Actions.

What is the dockerfile used for with Custom Actions? - ANSWER This is required to define the environment that the action will run in, defines libraries and other requirements, as well as calls scripts and contains details for building an image.

What is the Actions Meta data used for with Custom Actions? - ANSWER This defines the inputs, outputs, and entry point for the actions. Also defines the name, description, author, branding, and other details about the action.

Where does the Actions Meta Data go? - ANSWER This needs to be stored in the root of the directory with the name "action.yaml"

What are the types of Required Meta Data contained in the "action.yaml" file? - ANSWER This contains the Action Name, Description, Author, and Commands.

What are the types of Optional Meta Data contained in the "action.yaml" file?

  • ANSWER This contains the Inputs, Outputs, and Branding.

What is the Readme.md used for with Custom Actions? - ANSWER This is not

What are logs sizes limited to? - ANSWER These are limited to 64kb

How many secrets can a workflow have? - ANSWER These can have up to 100 secrets.

How large can secrets be? - ANSWER These can be up to 64kb in size.

Free accounts can store a max of what for artifacts? - ANSWER These are limited to a size off 500mb for storage.

What are the steps to creating an action? - ANSWER Create your .github/workflows/script.yaml file in the working repo

Define the name

Define the build event (on action)

Define your job steps

What are the steps for creating a custom action? - ANSWER 1. Navigate to your action repository CustomActionsRepo

  1. Create a folder- action-a/ ,action-b/, etc.
  2. Create a Dockerfile
  3. Create an Action.yaml metadata file
  1. define your entrypoint
  2. Create a readme containing important info about the action like usage
  3. Test out the action flow with your .github/workflows/main.yaml project file.