1
0
mirror of https://github.com/stackrox/kube-linter-action.git synced 2026-07-04 23:51:37 +00:00
Files
kube-linter-action/action.yml
T
2021-04-15 11:13:50 -04:00

39 lines
1.2 KiB
YAML
Executable File

name: 'kube-linter'
description: 'Scan directory with kube-linter'
inputs:
directory:
description: 'Directory to scan '
required: true
config:
description: 'Path to config file'
required: false
output-file:
description: 'Filename to store output. Default "kubelinter.log"'
required: false
default: 'kubelinter.log'
runs:
using: "composite"
steps:
- name: Download latest kube-linter
run: |
LOCATION=$(curl -s https://api.github.com/repos/stackrox/kube-linter/releases/latest \
| grep "tag_name" \
| awk '{print "https://github.com/stackrox/kube-linter/releases/download/" substr($2, 2, length($2)-3) "/kube-linter-linux.tar.gz"}')
curl -s -L -o kube-linter-linux.tar.gz $LOCATION
tar -xf kube-linter-linux.tar.gz -C "${GITHUB_WORKSPACE}/"
shell: bash
- name: Lint files
id: lint
run: |
set +e
cd "${GITHUB_WORKSPACE}"
if [ -z ${{ inputs.config }} ]; then
export CONFIG=""
else
export CONFIG="--config ${{ inputs.config }}"
fi
./kube-linter $CONFIG lint ${{ inputs.directory }} 2>&1 | tee ${{ inputs.output-file }}
result_code=${PIPESTATUS[0]}
exit $result_code
shell: bash