## Automating Boring Things
### with GitHub Actions, in Ruby
Wes Mason
`@1stvamp`
`@wes`
- Lights, Camera, Actions!
- (and Workflows!)
- (and JavaScript?)
- (and Ruby?!)
## GitHub Actions
- [github.com/features/actions](https://github.com/features/actions)
- [github.com/elastic/infra/actions](https://github.com/elastic/infra/actions)
## GitHub Actions
- Way of defining runnable code in a repo (um, okaaay?)
- Implement Continuous `{Integration,Deployment}`
- Run code on repo events (push, PRs, issue events etc.)
- Schedule code to run at set times (yeah, like `cron`)
## GitHub Actions
## Workflows
- What we really need is more YAML, right?
- Like TravisCI, CircleCI et al
```
name: Greet Everyone
on: [push]
jobs:
build:
name: Greeting
runs-on: ubuntu-latest
steps:
- name: Hello world
uses: actions/hello-world-javascript-action@v1
with:
who-to-greet: 'Mona the Octocat'
id: hello
- name: Echo the greeting's time
run: echo 'The time was ${{ steps.hello.outputs.time }}.'
```
#### `.github/workflows/my-super-workflow.yaml`
- `job.steps.***.uses` - predefined _actions_ you can use as dependencies
- `job.steps.***.uses.***.with` - params sent to the depended-on action when it's run
- `job.steps.***.run` - a command to run
#### `.github/workflows/my-super-workflow.yaml`
- `on` - the event to trigger this workflow
```
name: descriptive-workflow-name
on: push
```
```second
name: descriptive-workflow-name
on:
schedule:
- cron: '0 * * * *'
```
```
name: descriptive-workflow-name
on:
push:
branches:
- master
tags:
- v1
paths:
- 'test/*'
```
### GitHub Actions
- Runnable "smallest piece of code" (_ahem_, okay then)
- A job can stack multiple Actions to do different things
- The default runtime for Actions is a JavaScript one (NodeJS to be precise)
### wait, what was that last bit?
#### Options for writing actions and workflows with Ruby
- `Docker` image
- `actions/setup-ruby`
## sys.exit(0)
- Slides: [github.com/1stvamp/github-actions-ruby-talk](https://github.com/1stvamp/github-actions-ruby-talk)
- GitHub Help: [help.github.com/en/actions](https://help.github.com/en/actions/)
- Elastic Actions: [github.com/elastic/github-actions](https://github.com/elastic/github-actions)
- My gist: [git.io/JfpH6](https://git.io/JfpH6)
## ^D
- Jonathan "Joff" Oliver: [about.me/joffie](http://about.me/joffie)
- Ping me and say hi `:-)`