Github Actions Certification Flashcards

(132 cards)

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
What does the uses keyword do in a GitHub Actions workflow?
It specifies an action to use as part of a step.
24
What is the purpose of the env keyword in a GitHub Actions workflow?
To set environment variables for the entire workflow.
25
What does the if keyword do in a GitHub Actions workflow?
It adds conditional logic to the execution of jobs or steps.
26
What is the purpose of the matrix keyword?
To define a set of different configurations for a job.
27
What is the purpose of the needs keyword in a GitHub Actions workflow?
To specify job dependencies.
28
What is the purpose of the strategy keyword in a GitHub Actions workflow?
To define a set of different strategies for matrix builds.
29
What is Continuous Integration (CI)?
The practice of automatically building and testing code changes.
30
What is the purpose of the pull_request event in GitHub Actions?
To trigger the workflow when a pull request is created or updated.
31
What is the purpose of the push event in GitHub Actions?
To trigger the workflow when commits are pushed to the repository.
32
What does the jobs..strategy.matrix syntax allow you to do?
Run a job with multiple different configurations.
33
What is the purpose of the jobs..steps.run syntax?
To run a shell command in a job step.
34
What is the purpose of the timeout-minutes keyword?
To set a timeout for a job to prevent it from running indefinitely.
35
What is the purpose of the jobs..container syntax?
To specify a container to run the job in.
36
What is the purpose of the jobs..services syntax?
To specify additional services that the job requires.
37
What does the jobs..strategy.fail-fast option do?
Stops all matrix jobs if any matrix job fails.
38
What is the purpose of the jobs..continue-on-error option?
Allows the workflow to continue even if the job fails.
39
What is GitHub Packages?
A package hosting service integrated with GitHub.
40
What types of packages can be hosted on GitHub Packages?
Docker, npm, NuGet, Maven, and more.
41
What is the benefit of using GitHub Packages?
Simplifies package management and deployment.
42
How are permissions for GitHub Packages managed?
Based on the same permissions as the GitHub repository.
43
Can you use GitHub Actions to publish packages to GitHub Packages?
Yes, GitHub Actions can automate the publishing process.
44
How do you specify the registry for GitHub Packages in a workflow?
Using the registry field in the publish step.
45
What is the purpose of the GITHUB_TOKEN in publishing to GitHub Packages?
To authenticate the GitHub Actions runner with GitHub Packages.
46
What is the name field in a GitHub Packages workflow?
Specifies the name of the package.
47
What is the version field in a GitHub Packages workflow?
Specifies the version of the package.
48
Can you publish multiple packages in a single workflow?
Yes, by defining multiple publish steps.
49
What is a code package in GitHub Packages?
A reusable piece of code that can be downloaded and used in different projects.
50
How do you install a code package from GitHub Packages?
Using package managers like npm, NuGet, or Maven.
51
What is the benefit of code packages in GitHub Packages?
Reusability and versioning of code.
52
How do you specify dependencies in a GitHub Packages code package?
In the package configuration file (e.g., package.json for npm).
53
Can you use GitHub Actions to update code packages in GitHub Packages?
Yes, GitHub Actions can automate the update process.
54
What is a custom GitHub Action?
A reusable piece of code that encapsulates a set of instructions.
55
What are the two types of custom GitHub Actions?
Docker container actions and JavaScript actions.
56
What is the purpose of the action.yml file?
To define the metadata and inputs for the custom action.
57
What is the runs field in a custom GitHub Action?
Specifies how the action should be executed.
58
How do you use a custom GitHub Action in a workflow?
By referencing it in the uses field in a workflow step.
59
How do you publish a custom GitHub Action to the GitHub Marketplace?
By creating a release in the GitHub repository containing the action.
60
What is the purpose of the action.yml file in publishing a custom action?
It provides the metadata needed for the GitHub Marketplace.
61
What are the requirements for publishing a custom GitHub Action?
A valid action.yml file and a repository with a release.
62
Can you publish a custom GitHub Action without publishing it to the GitHub Marketplace?
Yes, you can use it directly from the repository.
63
What is the benefit of publishing a custom GitHub Action to the GitHub Marketplace?
Increased visibility and reusability.
64
How do you specify the Azure subscription in a GitHub Actions workflow?
Using the azure/credentials GitHub Secret.
65
What is the purpose of the azure/login action?
To authenticate the GitHub Actions runner with Azure.
66
What is the azure/deploy action used for?
To deploy code to an Azure service.
67
Can you deploy to multiple Azure services in a single workflow?
Yes, by defining multiple azure/deploy steps.
68
What is the benefit of using GitHub Actions for Azure deployments?
Automation and integration with GitHub repositories.
69
What is Continuous Deployment (CD)?
The practice of automatically deploying code changes to a production environment.
70
What is the purpose of the deployment event in GitHub Actions?
To trigger the workflow when a deployment is created.
71
What is the purpose of the jobs..environment syntax?
To specify the environment to which the job will deploy.
72
What does the jobs..concurrency option do?
Ensures that only one instance of the job runs at a time.
73
What is the purpose of the jobs..needs option in CD?
To specify job dependencies in a deployment workflow.
74
What is GitHub Enterprise?
A self-hosted version of GitHub designed for enterprise use.
75
How do you manage GitHub Actions workflows in GitHub Enterprise?
Through the GitHub Enterprise admin dashboard.
76
What are some enterprise-level features for managing GitHub Actions?
Audit logs, runner management, and secret management.
77
Can you enforce policies for GitHub Actions workflows in GitHub Enterprise?
Yes, through the admin dashboard.
78
What is the benefit of using GitHub Enterprise for GitHub Actions?
Enhanced security and management features.
79
What is a GitHub Actions runner in the context of GitHub Enterprise?
A self-hosted runner for executing GitHub Actions workflows.
80
How do you install a GitHub Actions runner in GitHub Enterprise?
Download and configure the runner software on a machine.
81
What are the benefits of using self-hosted runners in GitHub Enterprise?
Control over the environment and faster build times.
82
Can you use GitHub-hosted runners with GitHub Enterprise?
Yes, but self-hosted runners offer more control.
83
How do you manage GitHub Actions runners in GitHub Enterprise?
Through the GitHub Enterprise admin dashboard.
84
What are encrypted secrets in GitHub Actions?
Encrypted environment variables for storing sensitive information.
85
How do you create an encrypted secret at the organization level?
Go to organization Settings > Secrets and variables > Actions > New organization secret.
86
How do you access encrypted secrets within actions and workflows?
Using the secrets context in the workflow file.
87
Can you scope encrypted secrets to a specific repository?
Yes, through repository settings.
88
What is the risk of including encrypted secrets in an action's source code?
Actions are sharable units of work, so secrets could be exposed.
89
How can Github Enterprise Server sync available actions with Github Marketplace?
Download and run the actions-sync tool.
90
How do you make a workflow reusable?
Add the on: workflow_call: trigger.
91
How do you pass variables to reusable workflows?
with the "inputs:" and "secrets:" keywords as children to workflow_call:
92
How do you call a reusable workflow from an action?
With the using: keyword and specifying the workflow file with owner/repo/.github/workflows/action.yml@ref
93
How can a workflow get all the secrets of the calling workflow?
Use secrets: inherit
94
How can you add a summary of a finished job?
steps: - name: Adding markdown run: echo '### Hello world! 🚀' >> $GITHUB_STEP_SUMMARY
95
How can you make sure only one instance of an action run at the same time?
Create a concurrency: group: 'name' and also set cancel-in-progress: true
96
What is the keyword to specify the operating system on which the job will be executed ?
jobs: print-username: runs-on: ubuntu-latest steps:
97
What are the two "secure" ways to call a specific version of an Action
the version (semver) the commit hash
98
How to create a manual approval step in a workflow ?
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
Which trigger allows to start a workflow manually ?
workflow_dispatch
100
Which variable contains the name of the repository and the name of the owner?
GITHUB_REPOSITORY
101
Which variable contains the name of the user who triggered the workflow?
GITHUB_ACTOR
102
Which variable contains the name of the branch or tag which triggered the current workflow?
GITHUB_REF_NAME
103
Do the jobs of a workflow run on the same machine?
No
104
What are the three different ways to call a version of an Action?
the branch name the version (semver) the commit hash
105
How do you enforce your workflow running on a specific self-hosted agent running on Linux with ARM?
You need to use a "route" by specifying the labels you want to target: runs-on: [self-hosted, linux, ARM64]
106
You have a workflow secret named MY_SECRET. What is the format to call it from the workflow?
steps: - name: Hello world action with: # Set the secret as an input super_secret: ${{ secrets.MY_SECRET }}
107
What are the three types of custom Actions you can create?
Docker JavaScript Composite Actions
108
Which file containing metadata is mandatory?
The metadata filename must be either action.yml or action.yaml
109
Which fields are mandatory in the metadata file?
Name and description.
110
How do you return values from your GitHub Actions?
By defining outputs variables: outputs: sum: # id of the output description: 'The sum of the inputs'
111
How can you customize the icon and the background color of your custom GitHub Action?
By defining a branding section in the metadata file: branding: icon: 'award' color: 'green'
112
You want to create a custom JavaScript Action. What is the name of the main JavaScript file?
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
Name four rules that are prerequisites to publish an action in the marketplace?
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
Which is the first step to publish an action in the marketplace?
Create a Release
115
Can you prevent users to use Actions from the marketplace?
Yes, using Policies
116
Can you allow users to only used actions created by GitHub or verified creators?
Yes, using Policies and restricting to specific actions (Allow select actions)
117
Are the Actions created by GitHub automatically present in GitHub Enterprise Server?
Yes, but might not be the latest version.
118
What is the docker command to publish a container image on GitHub Packages?
docker push ghcr.io/OWNER/IMAGE_NAME:latest
119
What are the (programming) package managers supported by GitHub Packages?
npm, a NodeJS package manager NuGet, the .NET package manager RubyGems Maven and Gradle, two package managers for Java
120
How can you trigger a workflow after a pull request review has been approved?
pull-request-review
121
What components can be reused within a GitHub Organization? (Select four.)
Secrets, Workflow Templates, Self-Hosted Runners, Configuration Variables
122
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?
workflow_call
123
Which is a correct way to print a debug message?
echo "::debug::Watch out here!"
124
Which of these is a proper way of setting an output parameter PET with a value of DOG in a step.
echo "PET=DOG" >> "$GITHUB_OUTPUT"
125
To run a step only if the secret MY_SECRET has been set, You can:
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
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 }}"
5
127
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
Using OIDC
128
How do You access matrix variables in a matrix strategy job?
Using the matrix context
129
Where can You find network connectivity logs for a GitHub self-hosted-runner?
_diag folder
130