GitHub Commands

GitHub Steps

GitHub Jobs

GitHub Workflows

GitHub Actions

Agenda

  • Why
  • What
  • Events
  • Examples
  • Lots of details
    • Vocabulary (workflow, jobs, steps, actions)
    • JavaScript or Docker actions
    • Action sharing
    • Run in virtual env.
      • installed applications
  • Demo
  • Wrap up

Why?

Custom integrations

Pro-sumer (raw code)

  • Action and workflow sharing

  • Intelligence

Everybody have

separate

Hard to 
manage versions etc

What?

GitHub Actions - code that runs when an event happens on GitHub 

AWS Lambda - code that runs when an event happens in AWS

event

execution

effect

context

[ON REPOSTITORY]

[NOT ON ACCOUNT]

[NOT ON ORGANIZATION]

Events

push

pull_request

check_suite

delete

deployment

fork

gollum

issue_comment

issue

label

member

milestone

page_build

project

project_card

project_column

public

pull_request_review

release

status

watch

cron schedule

repository_dispatch

Workflow

event

execution

effect

context

[ON REPOSTITORY]

job

step

action

run

secrets

github

env

steps

matrix

job

runner

name: Hello KitsCon

on: [push]

jobs:
  greet:
    runs-on: ubuntu-latest

    steps:
      - name: Say hi
        run: echo "hi"
.github/workflows/main.yml

I don't see any actions?!

name: Hello KitsCon

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1
      - name: Install dependencies
        run: yarn install
      - name: Build project
        run: npm run build
.github/workflows/main.yml

💃🕺

name: S3 Deploy

on: [pull_request]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1
      - name: Install dependencies
        run: yarn install
      - name: Build project
        run: npm run build
      - name: S3 Deploy
        id: deploy_step
        uses: gustavjorlov/S3StageDeployAction@c37ac4d
        with:
          s3-bucket: "frontfailure"
          access-key-id: ${{secrets.AWS_ACCESS_KEY_ID}}
          secret-access-key: ${{secrets.AWS_SECRET_ACCESS_KEY}}
      - name: Deploy Output
        run: echo "${{ steps.deploy_step.outputs.s3_url }}"
.github/workflows/main.yml

🧐

Actions

  • Official
  • Community
  • Private
  • Docker
  • JavaScript

action.yml

index.js

name: "Send message to Slack"
description: "Sends message"
inputs:
  message:
    description: "Message"
    required: true
  slack-url:
    description: "Slack app url"
    required: true
runs:
  using: "node12"
  main: "index.js"
const axios = require("axios");
const core = require("@actions/core");

const slackUrl = core.getInput("slack-url");
const message = core.getInput("message");

try {
  axios.post(slackUrl, { text: message });
} catch (error) {
  core.setFailed(error.message);
}
name: Pull request reminder
on: [pull_request]

jobs:
  notify_slack:
    runs-on: ubuntu-latest
    steps:
      - name: Notify Slack
        uses: gustavjorlov/slacker@e74d5f0
        with:
          message: Hey, there's a PR!
          slack-url: ${{secrets.SLACK_URL}}

.github/workflows/main.yml

actions/toolkit

@actions/core

Provides functions for inputs, outputs, results, logging, secrets and variables

@actions/exec

Provides functions to exec cli tools and process output

@actions/io

Provides disk i/o functions like cp, mv, rmRF, find etc

@actions/tool-cache

Provides functions for downloading and caching tools. e.g. setup-* actions.

@actions/github

Provides an Octokit client hydrated with the context that the current action is being run in

Demo

Overseer

Conclusion

Not best CI

Not cheapest

...but

Perhaps closest to your code

Perhaps the easiest out there

Not "best" at anything

13 nov

GENERAL AVAILABILITY

Things I didn't mention

  • Upload artifacts
  • Parallell vs. serial job execution
  • Matrix build
  • ...lots more

GitHub Actions

By Gustav Jorlöv

GitHub Actions

  • 201