Ixchel Ruiz
Lights, Camera, GitHub Actions!
@ Utrecht JUG
Ixchel Ruiz
Senior Software Developer, DA @JFrog
@ixchelruiz@mastodon.social
www.linkedin.com/in/ixchelruiz
JUGUtrecht2023 - GithubActions
Github Actions
Github: Octoverse 2022
94M developers are on GitHub
Languages on GitHub → 1st JavaScript, 2nd Python, 3rd Java
Github Actions
Github Actions
Automated testing
Automatically responding to new issues, mentions
Triggering code reviews
Handling pull requests
Branch management
Github Actions : What?
Actions are the mechanism used to provide workflow
automation within the GitHub environment.
Github Actions : What?
Defined in YAML and stay within GitHub repositories
Executed on "runners," either hosted by GitHub or self-hosted
Contributed actions can be found in the GitHub Marketplace
Events
Work
fl
ows
Jobs
Actions
Trigger
Contain
Use
Github Actions
Name: name of the work
fl
ow
On: event or list that will trigger the work
fl
ow
Jobs: list of jobs to be executed
Runs-on: runner to use
Steps: list of steps (within a job executed on the same
runner)
Uses: prede
fi
ned action to be retrieved
Run: execute a command on the runner
JUGUtrecht2023 - GithubActions
JUGUtrecht2023 - GithubActions
inputs
github.event.inputs
JUGUtrecht2023 - GithubActions
Inputs
JUGUtrecht2023 - GithubActions
JUGUtrecht2023 - GithubActions
Workflow triggers : Events
Events
Events that occur in the work
fl
ow's repository
Events that occur outside of GitHub and trigger
a repository_dispatch event on GitHub
Scheduled times
Manual
Events
branch_protection_rule
check_run
check_suite
create
delete
deployment
deployment_status
discussion
discussion_comment
fork
gollum
issue_comment
issues
label
milestone
page_build
project
project_card
project_column
public
pull_request
pull_request_comment(use issue_comment)
pull_request_review
pull_request_review_comment
pull_request_target push
registry_package
release
repository_dispatch
schedule
status
watch
work
fl
ow_call
work
fl
ow_dispatch
work
fl
ow_run
Events
branch_protection_rule
check_run
check_suite
create
delete
deployment
deployment_status
discussion
discussion_comment
fork
gollum
issue_comment
issues
label
milestone
page_build
project
project_card
project_column
public
pull_request
pull_request_comment(use issue_comment)
pull_request_review
pull_request_review_comment
pull_request_target push
registry_package
release
repository_dispatch
schedule
status
watch
work
fl
ow_call
work
fl
ow_dispatch
work
fl
ow_run
Events
on:
gollum
Work
fl
ows can be executed when a GitHub webhook is called
This event would
fi
re when someone updates or
fi
rst creates a Wiki
page
Scheduling
Scheduling
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '30 5,17 * * *'
Every day at 5:30 and 17:30 UTC
Cron schedules are based on
fi
ve values:
Minute (0 - 59)
Hour (0 - 23)
Day of the month (1 - 31)
Month (1 - 12)
Day of the week (0 - 6)
on:
schedule:
- cron: '30 5 * * 1,3'
- cron: '30 5 * * 2,4'
jobs:
test_schedule:
runs-on: ubuntu-latest
steps:
- name: Not on Monday or Wednesday
if: github.event.schedule != '30 5 * * 1,3'
run: echo "This step will be skipped on Monday and Wednesday"
- name: Every time
run: echo "This step will always run"
cron: '30 5,17 * * *'
cron: '30 5 * * 1,3’
cron: '30 5 * * 2,4’
if: github.event.schedule != '30 5 * * 1,3'
Conditionals
jobs:
production-deploy:
if: github.repository == 'octo-org/octo-
repo-prod'
runs-on: ubuntu-latest
steps:
- name: My
fi
rst step
if: ${{ github.event_name == 'pull_request'
&& github.event.action == 'unassigned' }}
run: echo “This event is a pull request that
had an assignee removed”
if: github.repository == ‘octo-org/octo-repo-prod'
if: ${{ github.event_name == 'pull_request' && github.event.action == 'unassigned' }}
Filters
Filters
on:
pull_request:
types:
- opened
branches:
- 'releases/**'
paths:
- '**.js'
will only run when all
fi
lters are satis
fi
ed.
will only run when a pull request that includes a change to a JavaScript (.js)
fi
le is opened on a branch whose name starts with releases/
Filters : Refs
on:
pull_request:
# patterns refs/heads
branches-ignore:
- 'mona/octocat'
- ‘releases/**-alpha’
on:
pull_request:
branches:
- 'releases/**'
- '!releases/**-alpha'
branches-ignore branches: !
Filters: Tags
on:
push:
# patterns refs/heads
branches:
- main
- 'mona/octocat'
- 'releases/**'
# patterns refs/tags
tags:
- v2
- v1.*
on:
push:
#patterns refs/heads
branches-ignore:
- 'mona/octocat'
- 'releases/**-alpha'
# patterns refs/tags
tags-ignore:
- v2
- v1.*
will only run when all
fi
lters are satis
fi
ed.
tags-ignore
tags
Jobs
Jobs
Work
fl
ows contain one or more jobs
A job is a set of steps that will be run in order on a runner.
Steps within a job execute on the same runner and share the same
fi
lesystem
The logs produced by jobs are searchable
Jobs : Run
Jobs run in parallel by default.
sequentially → de
fi
ne dependencies ( needs )
needs
JUGUtrecht2023 - GithubActions
Defining prerequisite jobs
Prerequisite jobs: Expressions
jobs:
job1:
job2:
needs: job1
job3:
needs: [job1, job2]
*Requiring successful dependent jobs
jobs:
job1:
job2:
needs: job1
job3:
if: ${{ always() }}
needs: [job1, job2]
*Not requiring successful dependent jobs
if: ${{ always() }}
needs
Permissions
Permissions
actions: read | write | none
checks: read | write | none
contents: read | write | none
deployments: read | write | none
id-token: read | write | none
issues: read | write | none
discussions: read | write | none
packages: read | write | none
pages: read | write | none
pull-requests: read | write | none
repository-projects: read | write | none
security-events: read | write | none
statuses: read | write | none
JUGUtrecht2023 - GithubActions
permissions
permissions
Concurrency
Concurrency
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
concurrency:
group: ${{ github.work
fl
ow }}-${{ github.ref }}
cancel-in-progress: true
Using concurrency to cancel any in-progress job or run
Only cancel in-progress jobs or runs for the current work
fl
ow
Using a fallback value
concurrency:
group: '${{ github.work
fl
ow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
Reusable Workflows
Reusable Workflows
A work
fl
ow that uses another work
fl
ow is referred to as a "caller"
work
fl
ow.
The reusable work
fl
ow is a "called" work
fl
ow.
One "caller" work
fl
ow can use multiple "called" work
fl
ows.
Each "called" work
fl
ow is referenced in a single line.
Reusable Workflows
When a reusable work
fl
ow is triggered by a caller work
fl
ow, the github
context is always associated with the caller work
fl
ow.
The called work
fl
ow is automatically granted access to
github.token and secrets.GITHUB_TOKEN.
Reusable Workflows : outputs
name: Reusable work
fl
ow
on:
work
fl
ow_call:
# Map the work
fl
ow outputs to job outputs
outputs:
fi
rstword:
description: "The
fi
rst output string"
value: ${{ jobs.example_job.outputs.output1 }}
secondword:
description: "The second output string"
value: ${{ jobs.example_job.outputs.output2 }}
jobs:
example_job:
name: Generate output
runs-on: ubuntu-latest
# Map the job outputs to step outputs
outputs:
output1: ${{ steps.step1.outputs.
fi
rstword }}
output2: ${{ steps.step2.outputs.secondword }}
steps:
- id: step1
run: echo "
fi
rstword=hello" >> $GITHUB_OUTPUT
- id: step2
run: echo "secondword=world" >> $GITHUB_OUTPUT
name: Call a reusable work
fl
ow and use its outputs
on:
work
fl
ow_dispatch:
jobs:
job1:
uses: octo-org/example-repo/.github/work
fl
ows/called-work
fl
ow.yml@v1
job2:
runs-on: ubuntu-latest
needs: job1
steps:
- run: echo ${{ needs.job1.outputs.
fi
rstword }} ${{ needs.job1.outputs.secondword }}
called ( called-work
fl
ow.yml ) caller work
fl
ow
Reusable Workflows : secrets
jobs:
work
fl
owA-calls-work
fl
owB:
uses: octo-org/example-
repo/.github/work
fl
ows/B.yml@main
secrets: inherit
# pass all secrets
jobs:
work
fl
owB-calls-work
fl
owC:
uses: different-org/example-
repo/.github/work
fl
ows/C.yml@main
secrets:
envPAT: ${{ secrets.envPAT }}
# pass just this secret
B will inherit ALL secrets C will inherit envPAT secret
Reusable Workflows : Limitation
• Connect up to 4 levels of work
fl
ows
• Call a maximum of 20 reusable work
fl
ows
• Env variables ( env context @ caller work
fl
ow) not propagated to
called
• Env variables ( env context @ called work
fl
ow) not accessible to
caller Use outputs
• Reuse variables multiple work
fl
ows —> organization, repository, or environment levels (vars context)
• Reusable work
fl
ows (within a job and not step)
Secrets
Secrets
Secrets use Libsodium sealed boxes, so that they are encrypted
before reaching GitHub.
Never use structured data as a secret. Github attempts to redact any secrets that appear in run logs.
With the exception of GITHUB_TOKEN, secrets are not passed to the
runner when a work
fl
ow is triggered from a forked repository.
Secrets cannot be directly referenced in if: conditionals.
Register all secrets used within work
fl
ows
Demo
THANK YOU!

More Related Content

PDF
Introduction to GitHub Actions
PDF
Intro to GitHub Actions
PDF
Introduction to GitHub Actions – How to easily automate and integrate with Gi...
PDF
DWX 2023 - GitHub Actions für Azure-DevOps-Pipelines-Benutzer
PDF
GitHub Actions in action
PDF
Introduction to GitHub Actions - How to easily automate and integrate with Gi...
PDF
Deploying to DigitalOcean With GitHub Actions
PDF
Introduction to GitHub Actions
Introduction to GitHub Actions
Intro to GitHub Actions
Introduction to GitHub Actions – How to easily automate and integrate with Gi...
DWX 2023 - GitHub Actions für Azure-DevOps-Pipelines-Benutzer
GitHub Actions in action
Introduction to GitHub Actions - How to easily automate and integrate with Gi...
Deploying to DigitalOcean With GitHub Actions
Introduction to GitHub Actions

Similar to JUGUtrecht2023 - GithubActions (20)

PPTX
GITHUB_ACTIONS_CICD_OVERVIEW_FOR_BEGINNERS
PDF
DWX 2022 - DevSecOps mit GitHub
PDF
Intro to Github Actions @likecoin
PDF
DevOps Fest 2020. Alexey Golub. GitHub Actions in action
PDF
GitHubActionGitHubActionGitHubAction.pdf
PDF
github-actions.pdf
PDF
BASTA! 2022 - GitHub Actions für Nutzer der Azure DevOps Pipelines
PPTX
Github Action 開始簡易入門 DevOps,自動化你的專案 (LearnWeb Taiwan Meetup #15)
PDF
Learning Github Actions Automation And Integration Of Cicd With Github 1st Ed...
PDF
Introduction to Github Actions
PDF
Introduction to Github Actions
PPTX
Introduction to Github action Presentation
PPTX
GitHub Actions Security - DDOG
PPTX
GitHub Actions - using Free Oracle Cloud Infrastructure (OCI)
PPTX
CICD Pipeline Using Github Actions
PDF
Accelerate Microservices Deployments with Automation
PPTX
Git Workflows
PDF
FireWorks workflow software
PPTX
GitHub Actions Security
PPTX
Using GitHub Actions to Deploy your Workloads to Azure
GITHUB_ACTIONS_CICD_OVERVIEW_FOR_BEGINNERS
DWX 2022 - DevSecOps mit GitHub
Intro to Github Actions @likecoin
DevOps Fest 2020. Alexey Golub. GitHub Actions in action
GitHubActionGitHubActionGitHubAction.pdf
github-actions.pdf
BASTA! 2022 - GitHub Actions für Nutzer der Azure DevOps Pipelines
Github Action 開始簡易入門 DevOps,自動化你的專案 (LearnWeb Taiwan Meetup #15)
Learning Github Actions Automation And Integration Of Cicd With Github 1st Ed...
Introduction to Github Actions
Introduction to Github Actions
Introduction to Github action Presentation
GitHub Actions Security - DDOG
GitHub Actions - using Free Oracle Cloud Infrastructure (OCI)
CICD Pipeline Using Github Actions
Accelerate Microservices Deployments with Automation
Git Workflows
FireWorks workflow software
GitHub Actions Security
Using GitHub Actions to Deploy your Workloads to Azure
Ad

More from Ixchel Ruiz (10)

PDF
Failure is not an option
PDF
Failure is not an option
PDF
JCConf.tw 2022 - DevOps for Java developers
PDF
All about dependencies
PDF
DevoxxMA_MavenPuzzlers.pdf
PDF
(De) Human Future
PDF
DevoxxMA : The WHY series: Metrics
PDF
Voxxed Banff 2018 : Containers & Integration tests
PDF
Testing libraries for fun & profit. Beware: Increased productivity ahead
PDF
DevoxxUK one size fits all
Failure is not an option
Failure is not an option
JCConf.tw 2022 - DevOps for Java developers
All about dependencies
DevoxxMA_MavenPuzzlers.pdf
(De) Human Future
DevoxxMA : The WHY series: Metrics
Voxxed Banff 2018 : Containers & Integration tests
Testing libraries for fun & profit. Beware: Increased productivity ahead
DevoxxUK one size fits all
Ad

Recently uploaded (20)

PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PDF
August Patch Tuesday
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Five Habits of High-Impact Board Members
PDF
Architecture types and enterprise applications.pdf
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
STKI Israel Market Study 2025 version august
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
A novel scalable deep ensemble learning framework for big data classification...
DOCX
search engine optimization ppt fir known well about this
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PPTX
Tartificialntelligence_presentation.pptx
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
A comparative study of natural language inference in Swahili using monolingua...
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
August Patch Tuesday
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Five Habits of High-Impact Board Members
Architecture types and enterprise applications.pdf
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
STKI Israel Market Study 2025 version august
Univ-Connecticut-ChatGPT-Presentaion.pdf
Final SEM Unit 1 for mit wpu at pune .pptx
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
A novel scalable deep ensemble learning framework for big data classification...
search engine optimization ppt fir known well about this
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Tartificialntelligence_presentation.pptx
NewMind AI Weekly Chronicles – August ’25 Week III
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
Enhancing emotion recognition model for a student engagement use case through...
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
A comparative study of natural language inference in Swahili using monolingua...

JUGUtrecht2023 - GithubActions