Upgrade to Pro — share decks privately, control downloads, hide ads and more …

GitHub Actions

GitHub Actions

What are they, how to use them, and why you might want to!

Claire

June 06, 2019
Tweet

More Decks by Claire

Other Decks in Technology

Transcript

  1. 6th June 2019 DevOps Thames Valley/GitHub GitHub Actions What are

    they, how to use them, and why you might want to!
  2. GitHub Actions DevOps Thames Valley/GitHub - Who am I? -

    Why should you listen to me? - What are we going to cover? Welcome
  3. DevOps Thames Valley/GitHub GitHub Actions •No infrastructure required •Can be

    written in any language •Shareable on the GitHub Marketplace •Are now also able to be scheduled What is a GitHub Action? TL;DR Code that runs when something happens to or in a GitHub repository
  4. DevOps Thames Valley/GitHub GitHub Actions •Metadata about the event that

    triggered it •Any publicly available API, including the GitHub API •Secrets •Shared workspace, including a copy of the repository What can an Action Access?
  5. DevOps Thames Valley/GitHub GitHub Actions •Actions are run in order,

    and can be run in parallel •Editable in a visual editor on GitHub.com or a text editor •Any Action can halt a workflow with neutral or failed statuses What is an Action workflow? TL;DR Any number of Actions chained together in a DAG
  6. DevOps Thames Valley/GitHub GitHub Actions .github/main.workflow GitHub looks for files

    with the .workflow extension in a repository’s .github folder.
  7. DevOps Thames Valley/GitHub GitHub Actions workflow "Test my code" {

    on = "push" resolves = ["npm test"] } action "npm install" { uses = "actions/npm@master" args = ["install"] } action "npm test" { uses = "actions/npm@master" args = ["test"] needs = ["npm install"] }
  8. DevOps Thames Valley/GitHub GitHub Actions Key Points A workflow can

    contain 100 actions A workflow can run for up to 58 minutes An action cannot trigger other workflows An action must point to a valid Dockerfile
  9. GitHub Actions DevOps Thames Valley/GitHub LABEL "com.github.actions.name"="Slack Bot Action" LABEL

    "com.github.actions.description"="A GitHub Action that posts a message to Slack either from hardcoded strings or data from previous workflow Actions/steps" LABEL "com.github.actions.icon"="hash" LABEL "com.github.actions.color"="purple" Dockerfile Properties *Any* Docker image can be used! Specific GitHub labels:
  10. DevOps Thames Valley/GitHub GitHub Actions Other Points Actions can be

    customised with args Various environment variables provided The code can be anything that runs in a Docker image It’s not just CI! Actions is about the whole development process
  11. DevOps Thames Valley/GitHub GitHub Actions •Official Documentation: https://developer.github.com/actions/ •Actionable Actions

    workshop: http://bit.ly/actionable-actions •The life of a GitHub Action: https://blog.jessfraz.com/post/the-life-of- a-github-action/ •GitHub provided Utilities: https://github.com/actions/bin Resources
  12. GitHub Actions DevOps Thames Valley/GitHub Automate Chores • Code Quality/Review

    - Linting and schema validation - Merge on approved PRs - Scanning for secrets • Dependency Management - Check licensing of dependencies • Project Management - Move cards in project boards - Automatically label PRs and Issues
  13. GitHub Actions DevOps Thames Valley/GitHub Keeping Up-to-Date • General messaging

    - The usual suspects: Slack, SMS, Facebook Messenger, Telegram, … • Monitoring - And then send messaging using the above! • Release notes and changelog generation • Broadcast: Tweet, Email, …
  14. GitHub Actions DevOps Thames Valley/GitHub Continuous Integration • Testing -

    Test suites - Code coverage • Publishing/Releasing - GPR, npm, Rubygems, Docker, … - GitHub Release • Deploying - Azure, AWS, Google Cloud, Heroku - Own servers via rsync, ssh, scp - Websites e.g. GitHub Pages, Jekyll, Netlify, Gatsby