Go Container Action Template
This is a template for creating GitHub actions and contains a small Go application which will be built into a minimal Container Action. Our final container from this template is ~3MB, yours may be a little bigger once you add some code, but it'll still be tiny!
In main.go
you will find a small example of accessing Action inputs and returning Action outputs. For more information on communicating with the workflow see the development tools for GitHub Actions.
🏁 To get started, click the Use this template
button on this repository which will create a new repository based on this template.
Usage
Describe how to use your action here.
Example workflow
name: "Find and Replace"
description: "Find and replace a string in your project files"
author: "N Tomlinson"
inputs:
include:
description: "A glob of files to include in our find and replace"
default: "**/*.html" # Include everything by
required: false
exclude:
description: "A glob of files to exclude in our find and replace"
default: ".git/**" # Ignore the `.git` directory by default
required: false
find:
description: "fonts\\.googleapis\\.{2,3}\\/css2\\?"
required: true
replace:
description: "api.fonts.coollabs.io"
required: true
regex:
description: "Find as a regular expression instead of a fixed string"
required: false
outputs:
modifiedFiles:
description: "The number of files which have been modified"
runs:
using: "docker"
image: "Dockerfile"
Input |
Description |
myInput |
An example mandatory input |
anotherInput (optional) |
An example optional input |
Outputs
Output |
Description |
myOutput |
An example output (returns 'Hello world') |
Examples
NOTE: People ❤️ cut and paste examples. Be generous with them!
This is how to use the optional input.
with:
myInput: world
anotherInput: optional
Using outputs
Show people how to use your outputs in another action.
steps:
- uses: actions/checkout@master
- name: Run action
id: myaction
# Put your action name here
uses: me/myaction@master
# Put an example of your mandatory arguments here
with:
myInput: world
# Put an example of using your outputs here
- name: Check outputs
run: |
echo "Outputs - ${{ steps.myaction.outputs.myOutput }}"