These are NOT real questions from the exam but quite close enough to what you can get to help you to prepare it and obtain the certification
- Author and maintain workflows (40% of the exam)
- Consume workflows (20% of the exam)
- Author and maintain actions (25% of the exam)
- Manage GitHub Actions for the enterprise (15% of the exam)
show
on:
push:
branches:
- mainshow
on:
pull_request:
branches:
- mainshow
needs
jobs:
job1:
job2:
needs: job1
job3:
needs: [job1, job2]show
.github/workflows
Suppose you have created a bug fix on a new branch and want it to become part of the next production build generated from the main branch. What should you do next? ?
show
Create a pull request to merge your new branch into the main branch.
show
runs-on
jobs:
print-username:
runs-on: ubuntu-latest
steps:show
- the version (semver)
- the commit hash
steps:
- uses: github/my-action@v1
- uses: github/my-action@734713bc047d87bf7eac9674765ae793478c50d3The branch name is not secure as it can change at anytime. The version (using semver) is most secure IF the developer never overwrite a previous version/tag
show
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'show
- Linux (ubuntu)
- Windows (windows server)
- Mac OS
show
workflow_dispatch
jobs:
example_matrix:
strategy:
matrix:
version: [10, 12, 14]
os: [ubuntu-latest, windows-latest]show
6 combinations
show
GITHUB_REPOSITORY
show
GITHUB_ACTOR
show
GITHUB_REF_NAME
/!\ GITHUB_REF will contains the full name (refs/heads/<branch_name>)
show
No. Which means that a file/anything created by a job, cannot be retrieved by a second job automatically.
show
- the branch name
- the version (semver)
- the commit hash
steps:
- uses: github/my-action@v1
- uses: github/my-action@main
- uses: github/my-action@734713bc047d87bf7eac9674765ae793478c50d3How do you enforce your workflow running on a specific self-hosted agent running on Linux with ARM ?
show
You need to use a "route" by specifying the labels you want to target:
runs-on: [self-hosted, linux, ARM64]show
steps:
- name: Hello world action
with: # Set the secret as an input
super_secret: ${{ secrets.MY_SECRET }}show
- Docker
- JavaScript
- Composite Actions
show
The metadata filename must be either action.yml or action.yaml
- name
- description
- version
- inputs
- author
show
Name and description. Inputs and author are optional. Version does not exist
show
By defining outputs variables:
outputs:
sum: # id of the output
description: 'The sum of the inputs'show
By defining a branding section in the metadata file:
branding:
icon: 'award'
color: 'green'show
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'- 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.
show
To create a Release.
show
Yes, using Policies and restricting to local actions only.
show
Yes, using Policies and restricting to specific actions (menu "Allow select actions").
show
Yes, but they may not be the last version of them.
show
Yes.
show
docker push ghcr.io/OWNER/IMAGE_NAME:latestshow
- npm, a NodeJS package manager
- NuGet, the .NET package manager
- RubyGems
- Maven and Gradle, two package managers for Java
- When I want to share code between methods of my application.
- When I want to share container images among developers of your team.
- When I want to publish a small code library as an open-source project.
show
When I want to share code between methods of my application
show
- uses: actions/upload-artifact@v3
with:
name: my-artifact
path: path/to/artifact/world.txtshow
You can use upload-artifact and download-artifact
jobs:
job1:
steps:
- uses: actions/checkout@v2
- run: mkdir -p path/to/artifact
- run: echo hello > path/to/artifact/world.txt
- uses: actions/upload-artifact@v2
with:
name: my-artifact
path: path/to/artifact/world.txt
job2:
steps:
- uses: actions/download-artifact@v2
with:
name: my-artifact