26
loading...
This website collects cookies to deliver better user experience
username.github.io
or you can connect your own domain. There’s just one downside.action.yml
file, describing its inputs and outputs. That means an action can basically do anything you want. It is worth mentioning though, that you actually don’t even have to use actions in your workflows at all. You can also just run arbitrary commands on the operating system the workflow runs on and sometimes that is all you need. You can think of GitHub Workflows simply as… “executing stuff” on a virtual machine that GitHub spawns for you on demand..github/workflows
directory of your repository. GitHub will automatically pick that up and run it according to the terms you configure. Here’s a hello-world.yml
that shows probably the most simple and useless workflow possible:name: Hello World
on:
schedule:
- cron: '0 0 * * *'
jobs:
hello-world:
runs-on: ubuntu-latest
steps:
- run: echo Hello World!
jobs:
hello-world:
runs-on: ubuntu-latest
steps:
- uses: hello-world/say-action@v1
with:
say: Hello World!
jobs:
hello-world:
runs-on: ubuntu-latest
steps:
- id: get-name
uses: hello-world/get-name-action@v1 # has a "name" output
- uses: hello-world/greet-action@v1
with:
name: ${{ steps.get-name.outputs.name }}
jobs:
get-name:
runs-on: ubuntu-latest
outputs:
name: ${{ steps.get-name.outputs.name }}
steps:
- id: get-name
uses: hello-world/get-name-action@v1 # has a "name" output
say-name:
runs-on: ubuntu-latest
steps:
- uses: hello-world/greet-action@v1
with:
name: ${{ steps.get-name.outputs.name }}
steps:
- run: echo ${{ secrets.SECRET_STRING }}
jobs:
hello-world:
runs-on: ubuntu-latest
environment: development
steps:
- run: echo ${{ secrets.DEVELOPMENT_ENV_SECRET }}
jobs:
build-and-push-docker-image:
runs-on: ubuntu-latest
steps:
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
@v1
at the end, which is a branch or tag name. Now, Docker might be a trustworthy author but even trusted organizations might have a new team member every now and then and sometimes new team members turn out to be not as trustworthy as the rest of the organization they just joined and security policies are sometimes more a theoretical thing. Anyway… At the latest when working with unverified actions you need to be aware of one thing (in case you aren’t already):- name: Login to shady service
uses: trustme/spy-action@`172239021f7ba04fe7327647b213799853a9eb89`
with:
password: ${{ secrets.SUPER_SECURE_PASSWORD }}
github
variable lets you access the context of a workflow run, e.g. the event that triggered it, including the pull request object itself.