To write a custom GitHub Action is actually quite simple.
The custom GitHub Action i wrote uses the containerized approach as opposed to the JavaScript way.
First, you define a action.yml
name: 'action to print memory info of a docker container'
description: 'Github Container Action to display the memory information of the docker container for this container action'
author: 'Colin But'
inputs:
myInput:
description: 'message to display'
required: true
default: 'Colin'
outputs:
myOutput:
description: 'total memory'
runs:
using: 'docker'
image: 'Dockerfile'
The action.yml
defines your GitHub Action detailing what inputs to accept (if any) and what outputs it spits out (if any). It also specifies the path to the to the associated Dockerfile
within the GitHub repository that defines the workload of the GitHub Action itself.
My example is a very simple example that just prints out the memory footprint of the running Docker container that is used to execute this particular GitHub Action.
Dockerfile
here it is:
FROM debian:9.5-slim
ADD entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]