Interview Prep/GitHub Actions/Custom Actions & Reusable Workflows

How do you write a Docker container action and pass inputs to it?

IntermediateConceptCustom Actions & Reusable Workflows
Answer
# action.yml
name: Kubeconform
inputs:
  path: { description: Manifests dir, default: k8s }
runs:
  using: docker
  image: Dockerfile            # or docker://ghcr.io/org/kubeconform-action:1.2.0
  args:
    - ${{ inputs.path }}
FROM ghcr.io/yannh/kubeconform:v0.6.7-alpine
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

Inputs also arrive as env vars INPUT_PATH. The workspace is mounted at /github/workspace. Prefer a prebuilt published image over Dockerfile so consumers do not rebuild it every run.

All GitHub Actions questions Roadmap: GitHub Actions

More on Custom Actions & Reusable Workflows