Github Actions Certification Flashcards

1
Q

What is the primary purpose of GitHub Actions?

A

To automate software development workflows.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the three main components of a GitHub Action?

A

Workflows, Jobs, and Steps.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a GitHub Actions workflow?

A

An automated process added to a repository to build, test, package, release, or deploy a project.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a GitHub Actions job?

A

A section of the workflow associated with a runner.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a GitHub Actions step?

A

An individual task that can run commands in a job.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What triggers a GitHub Actions workflow?

A

An event triggers the workflow.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a runner in GitHub Actions?

A

A machine where the job runs, can be GitHub-hosted or self-hosted.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What attribute specifies the runner?

A

The runs-on: attribute.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are actions?

A

Standalone commands that are executed within a workflow.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the uses: attribute in a step?

A

It specifies the path to the container action defined in an action.yml file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How can you schedule a GitHub Actions workflow?

A

Using the schedule event with POSIX cron syntax.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the workflow_dispatch event?

A

Allows manual triggering of a workflow via GitHub REST API or the Actions tab.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How can you trigger a workflow for external events?

A

Using the repository_dispatch event and sending a POST request to GitHub.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are conditional keywords in GitHub Actions?

A

Keywords like if that allow you to evaluate expressions and run steps conditionally.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How can you disable a GitHub Actions workflow?

A

You can stop it from being triggered without deleting the file, either on GitHub or through the GitHub REST API.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the purpose of a GitHub Actions workflow file?

A

To define the automated process for building, testing, and deploying code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the two main components of a GitHub Actions workflow?

A

Jobs and Steps

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the default name of the GitHub Actions workflow file?

A

.github/workflows/main.yml

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is the purpose of the on keyword in a GitHub Actions workflow?

A

To specify the events that trigger the workflow.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What does the jobs section in a GitHub Actions workflow define?

A

It defines the tasks to be executed in the workflow.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What are GitHub-hosted runners?

A

Virtual machines hosted by GitHub to run workflows.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is the purpose of the runs-on keyword?

A

To specify the type of runner to use for the job.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What are self-hosted runners?

A

Runners that you host yourself in your own infrastructure.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is the purpose of the steps keyword?

A

To define a sequence of tasks to be executed in a job.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What does the uses keyword do in a GitHub Actions workflow?

A

It specifies an action to use as part of a step.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What is the purpose of the env keyword in a GitHub Actions workflow?

A

To set environment variables for the entire workflow.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What does the if keyword do in a GitHub Actions workflow?

A

It adds conditional logic to the execution of jobs or steps.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

What is the purpose of the matrix keyword?

A

To define a set of different configurations for a job.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

What is the purpose of the needs keyword in a GitHub Actions workflow?

A

To specify job dependencies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

What is the purpose of the strategy keyword in a GitHub Actions workflow?

A

To define a set of different strategies for matrix builds.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

What is Continuous Integration (CI)?

A

The practice of automatically building and testing code changes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

What is the purpose of the pull_request event in GitHub Actions?

A

To trigger the workflow when a pull request is created or updated.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

What is the purpose of the push event in GitHub Actions?

A

To trigger the workflow when commits are pushed to the repository.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

What does the jobs.<job_id>.strategy.matrix syntax allow you to do?</job_id>

A

Run a job with multiple different configurations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

What is the purpose of the jobs.<job_id>.steps.run syntax?</job_id>

A

To run a shell command in a job step.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

What is the purpose of the timeout-minutes keyword?

A

To set a timeout for a job to prevent it from running indefinitely.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

What is the purpose of the jobs.<job_id>.container syntax?</job_id>

A

To specify a container to run the job in.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

What is the purpose of the jobs.<job_id>.services syntax?</job_id>

A

To specify additional services that the job requires.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

What does the jobs.<job_id>.strategy.fail-fast option do?</job_id>

A

Stops all matrix jobs if any matrix job fails.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

What is the purpose of the jobs.<job_id>.continue-on-error option?</job_id>

A

Allows the workflow to continue even if the job fails.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

What is GitHub Packages?

A

A package hosting service integrated with GitHub.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

What types of packages can be hosted on GitHub Packages?

A

Docker, npm, NuGet, Maven, and more.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

What is the benefit of using GitHub Packages?

A

Simplifies package management and deployment.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

How are permissions for GitHub Packages managed?

A

Based on the same permissions as the GitHub repository.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

Can you use GitHub Actions to publish packages to GitHub Packages?

A

Yes, GitHub Actions can automate the publishing process.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

How do you specify the registry for GitHub Packages in a workflow?

A

Using the registry field in the publish step.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

What is the purpose of the GITHUB_TOKEN in publishing to GitHub Packages?

A

To authenticate the GitHub Actions runner with GitHub Packages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

What is the name field in a GitHub Packages workflow?

A

Specifies the name of the package.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

What is the version field in a GitHub Packages workflow?

A

Specifies the version of the package.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

Can you publish multiple packages in a single workflow?

A

Yes, by defining multiple publish steps.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

What is a code package in GitHub Packages?

A

A reusable piece of code that can be downloaded and used in different projects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

How do you install a code package from GitHub Packages?

A

Using package managers like npm, NuGet, or Maven.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

What is the benefit of code packages in GitHub Packages?

A

Reusability and versioning of code.

52
Q

How do you specify dependencies in a GitHub Packages code package?

A

In the package configuration file (e.g., package.json for npm).

53
Q

Can you use GitHub Actions to update code packages in GitHub Packages?

A

Yes, GitHub Actions can automate the update process.

54
Q

What is a custom GitHub Action?

A

A reusable piece of code that encapsulates a set of instructions.

55
Q

What are the two types of custom GitHub Actions?

A

Docker container actions and JavaScript actions.

56
Q

What is the purpose of the action.yml file?

A

To define the metadata and inputs for the custom action.

57
Q

What is the runs field in a custom GitHub Action?

A

Specifies how the action should be executed.

58
Q

How do you use a custom GitHub Action in a workflow?

A

By referencing it in the uses field in a workflow step.

59
Q

How do you publish a custom GitHub Action to the GitHub Marketplace?

A

By creating a release in the GitHub repository containing the action.

60
Q

What is the purpose of the action.yml file in publishing a custom action?

A

It provides the metadata needed for the GitHub Marketplace.

61
Q

What are the requirements for publishing a custom GitHub Action?

A

A valid action.yml file and a repository with a release.

62
Q

Can you publish a custom GitHub Action without publishing it to the GitHub Marketplace?

A

Yes, you can use it directly from the repository.

63
Q

What is the benefit of publishing a custom GitHub Action to the GitHub Marketplace?

A

Increased visibility and reusability.

64
Q

How do you specify the Azure subscription in a GitHub Actions workflow?

A

Using the azure/credentials GitHub Secret.

65
Q

What is the purpose of the azure/login action?

A

To authenticate the GitHub Actions runner with Azure.

66
Q

What is the azure/deploy action used for?

A

To deploy code to an Azure service.

67
Q

Can you deploy to multiple Azure services in a single workflow?

A

Yes, by defining multiple azure/deploy steps.

68
Q

What is the benefit of using GitHub Actions for Azure deployments?

A

Automation and integration with GitHub repositories.

69
Q

What is Continuous Deployment (CD)?

A

The practice of automatically deploying code changes to a production environment.

70
Q

What is the purpose of the deployment event in GitHub Actions?

A

To trigger the workflow when a deployment is created.

71
Q

What is the purpose of the jobs.<job_id>.environment syntax?</job_id>

A

To specify the environment to which the job will deploy.

72
Q

What does the jobs.<job_id>.concurrency option do?</job_id>

A

Ensures that only one instance of the job runs at a time.

73
Q

What is the purpose of the jobs.<job_id>.needs option in CD?</job_id>

A

To specify job dependencies in a deployment workflow.

74
Q

What is GitHub Enterprise?

A

A self-hosted version of GitHub designed for enterprise use.

75
Q

How do you manage GitHub Actions workflows in GitHub Enterprise?

A

Through the GitHub Enterprise admin dashboard.

76
Q

What are some enterprise-level features for managing GitHub Actions?

A

Audit logs, runner management, and secret management.

77
Q

Can you enforce policies for GitHub Actions workflows in GitHub Enterprise?

A

Yes, through the admin dashboard.

78
Q

What is the benefit of using GitHub Enterprise for GitHub Actions?

A

Enhanced security and management features.

79
Q

What is a GitHub Actions runner in the context of GitHub Enterprise?

A

A self-hosted runner for executing GitHub Actions workflows.

80
Q

How do you install a GitHub Actions runner in GitHub Enterprise?

A

Download and configure the runner software on a machine.

81
Q

What are the benefits of using self-hosted runners in GitHub Enterprise?

A

Control over the environment and faster build times.

82
Q

Can you use GitHub-hosted runners with GitHub Enterprise?

A

Yes, but self-hosted runners offer more control.

83
Q

How do you manage GitHub Actions runners in GitHub Enterprise?

A

Through the GitHub Enterprise admin dashboard.

84
Q

What are encrypted secrets in GitHub Actions?

A

Encrypted environment variables for storing sensitive information.

85
Q

How do you create an encrypted secret at the organization level?

A

Go to organization Settings > Secrets and variables > Actions > New organization secret.

86
Q

How do you access encrypted secrets within actions and workflows?

A

Using the secrets context in the workflow file.

87
Q

Can you scope encrypted secrets to a specific repository?

A

Yes, through repository settings.

88
Q

What is the risk of including encrypted secrets in an action’s source code?

A

Actions are sharable units of work, so secrets could be exposed.

89
Q

How can Github Enterprise Server sync available actions with Github Marketplace?

A

Download and run the actions-sync tool.

90
Q

How do you make a workflow reusable?

A

Add the on:
workflow_call: trigger.

91
Q

How do you pass variables to reusable workflows?

A

with the “inputs:” and “secrets:” keywords as children to workflow_call:

92
Q

How do you call a reusable workflow from an action?

A

With the using: keyword and specifying the workflow file with owner/repo/.github/workflows/action.yml@ref

93
Q

How can a workflow get all the secrets of the calling workflow?

A

Use secrets: inherit

94
Q

How can you add a summary of a finished job?

A

steps:
- name: Adding markdown
run: echo ‘### Hello world! 🚀’&raquo_space; $GITHUB_STEP_SUMMARY

95
Q

How can you make sure only one instance of an action run at the same time?

A

Create a concurrency: group: ‘name’ and also set cancel-in-progress: true

96
Q

What is the keyword to specify the operating system on which the job will be executed ?

A

jobs:
print-username:
runs-on: ubuntu-latest
steps:

97
Q

What are the two “secure” ways to call a specific version of an Action

A

the version (semver)
the commit hash

98
Q

How to create a manual approval step in a workflow ?

A

There are different steps. First you need to create an Environment (let’s call it “dev”).

Then, in this environment you need to define protection rules and especially the rule “Required reviewers”

Finally, you need for the job you want an approval for, to reference the newly created/configured environment :

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:

deploy-dev:
runs-on: ‘ubuntu-latest’
environment: ‘dev’

99
Q

Which trigger allows to start a workflow manually ?

A

workflow_dispatch

100
Q

Which variable contains the name of the repository and the name of the owner?

A

GITHUB_REPOSITORY

101
Q

Which variable contains the name of the user who triggered the workflow?

A

GITHUB_ACTOR

102
Q

Which variable contains the name of the branch or tag which triggered the current workflow?

A

GITHUB_REF_NAME

103
Q

Do the jobs of a workflow run on the same machine?

A

No

104
Q

What are the three different ways to call a version of an Action?

A

the branch name
the version (semver)
the commit hash

105
Q

How do you enforce your workflow running on a specific self-hosted agent running on Linux with ARM?

A

You need to use a “route” by specifying the labels you want to target:

runs-on: [self-hosted, linux, ARM64]

106
Q

You have a workflow secret named MY_SECRET. What is the format to call it from the workflow?

A

steps:
- name: Hello world action
with: # Set the secret as an input
super_secret: ${{ secrets.MY_SECRET }}

107
Q

What are the three types of custom Actions you can create?

A

Docker
JavaScript
Composite Actions

108
Q

Which file containing metadata is mandatory?

A

The metadata filename must be either action.yml or action.yaml

109
Q

Which fields are mandatory in the metadata file?

A

Name and description.

110
Q

How do you return values from your GitHub Actions?

A

By defining outputs variables:

outputs:
sum: # id of the output
description: ‘The sum of the inputs’

111
Q

How can you customize the icon and the background color of your custom GitHub Action?

A

By defining a branding section in the metadata file:

branding:
icon: ‘award’
color: ‘green’

112
Q

You want to create a custom JavaScript Action. What is the name of the main JavaScript file?

A

Whatever you want as long as the name is specified in the action.yaml file:

name: ‘Hello World by me’ # name of the action (mandatory)
description: ‘Says hello to someone’ # simple description (mandatory)
author: ‘Louis-Guillaume MORAND’ # author (optional)
runs:
using: ‘node12’
main: ‘index.js’

113
Q

Name four rules that are prerequisites to publish an action in the marketplace?

A

The action must be in a public repository.
Each repository must contain a single action.
The action’s metadata file (action.yml or action.yaml) must be in the root directory of the repository.
The name in the action’s metadata file must be unique.

114
Q

Which is the first step to publish an action in the marketplace?

A

Create a Release

115
Q

Can you prevent users to use Actions from the marketplace?

A

Yes, using Policies

116
Q

Can you allow users to only used actions created by GitHub or verified creators?

A

Yes, using Policies and restricting to specific actions (Allow select actions)

117
Q

Are the Actions created by GitHub automatically present in GitHub Enterprise Server?

A

Yes, but might not be the latest version.

118
Q

What is the docker command to publish a container image on GitHub Packages?

A

docker push ghcr.io/OWNER/IMAGE_NAME:latest

119
Q

What are the (programming) package managers supported by GitHub Packages?

A

npm, a NodeJS package manager
NuGet, the .NET package manager
RubyGems
Maven and Gradle, two package managers for Java

120
Q

How can you trigger a workflow after a pull request review has been approved?

A

pull-request-review

121
Q

What components can be reused within a GitHub Organization? (Select four.)

A

Secrets, Workflow Templates, Self-Hosted Runners, Configuration Variables

122
Q

You want to create a reusable workflow CI that runs some quality checks, linting and tests on code changes. What event trigger should the CI workflow define to allow reusing it in other workflows?

A

workflow_call

123
Q

Which is a correct way to print a debug message?

A

echo “::debug::Watch out here!”

124
Q

Which of these is a proper way of setting an output parameter PET with a value of DOG in a step.

A

echo “PET=DOG”&raquo_space; “$GITHUB_OUTPUT”

125
Q

To run a step only if the secret MY_SECRET has been set, You can:

A

Set the secret MY_SECRET as a job level environment variable, then reference that environment variable to conditionally run that step
my-job:
runs-on: ubuntu-latest
env:
my_secret: ${{ secrets.MY_SECRET }}
steps:
- if: ${{ env.my_secret != ‘’ }}

126
Q

How many jobs will be executed in the following workflow?

jobs:
matrix-job:
runs-on: ubuntu-latest
strategy:
matrix:
pet: [cat, dog]
color: [pink, brown]
include:
- color: white
pet: dog
steps:
- run: echo “Hello ${{ matrix.color }} ${{ matrix.pet }}”

A

5

127
Q

When using Github Actions to access resources in one of the cloud providers (such as AWS, Azure or GCP) the safest and recommended way to authenticate is

A

Using OIDC

128
Q

How do You access matrix variables in a matrix strategy job?

A

Using the matrix context

129
Q

Where can You find network connectivity logs for a GitHub self-hosted-runner?

A

_diag folder

130
Q
A