Skip to content

Instantly share code, notes, and snippets.

@masutaka
Last active January 27, 2019 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masutaka/6bb0d4c2d33818be8d03ffb60ef84c6e to your computer and use it in GitHub Desktop.
Save masutaka/6bb0d4c2d33818be8d03ffb60ef84c6e to your computer and use it in GitHub Desktop.
A sample files of GitHub Actions
.github
├── hadolint
│ ├── Dockerfile (hadolint_Dockerfile)
│   └── entrypoint.sh (hadolint_entrypoint.sh)
├── main.workflow (01main.workflow)
└── shellcheck
├── Dockerfile (shellcheck_Dockerfile)
└── entrypoint.sh (shellcheck_entrypoint.sh)
workflow "masutaka.net" {
on = "push"
resolves = ["hadolint", "shellcheck"]
}
action "hadolint" {
uses = "./.github/hadolint"
args = ["Dockerfile*", ".github/**/Dockerfile"]
}
action "shellcheck" {
uses = "./.github/shellcheck"
args = ["script/*", ".github/**/entrypoint.sh"]
}
FROM alpine:3.8
LABEL "com.github.actions.icon"="target"
LABEL "com.github.actions.color"="blue"
RUN apk add --no-cache --no-progress curl=7.61.1-r1
ENV HADOLINT_VERSION=v1.15.0 \
HADOLINT_PATH=/usr/local/bin/hadolint
RUN curl -sLo $HADOLINT_PATH https://github.com/hadolint/hadolint/releases/download/${HADOLINT_VERSION}/hadolint-Linux-x86_64 && \
chmod 500 $HADOLINT_PATH
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
#!/bin/sh -eux
# shellcheck disable=SC2068
hadolint -v
hadolint $@
FROM alpine:3.8
LABEL "com.github.actions.icon"="terminal"
LABEL "com.github.actions.color"="purple"
RUN apk add --no-cache --no-progress curl=7.61.1-r1
ENV SHELLCHECK_VERSION=v0.6.0
WORKDIR /usr/local/bin
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
RUN curl -s https://storage.googleapis.com/shellcheck/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz | \
tar xvJf - --strip-components=1 shellcheck-${SHELLCHECK_VERSION}/shellcheck
WORKDIR /
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
#!/bin/sh -eux
# shellcheck disable=SC2068
shellcheck -V
shellcheck $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment