63 lines
1.8 KiB
YAML
63 lines
1.8 KiB
YAML
# GitHub Actions composite action — glint pipeline validator
|
|||
|
|
#
|
||
|
|
# To use this action, mirror this repository to GitHub as k3nny/glint, then:
|
||
|
|
#
|
||
|
|
# - uses: k3nny/glint@v0.2.28
|
||
|
|
# with:
|
||
|
|
# file: .gitlab-ci.yml # optional
|
||
|
|
#
|
||
|
|
# Alternatively, copy this file into your own repository and reference it
|
||
|
|
# as a local action:
|
||
|
|
#
|
||
|
|
# - uses: ./.github/actions/glint
|
||
|
|
|
||
|
|
name: 'glint'
|
||
|
|
description: 'Validate a GitLab CI pipeline file with glint'
|
||
|
|
author: 'k3nny'
|
||
|
|
|
||
|
|
branding:
|
||
|
|
icon: 'check-circle'
|
||
|
|
color: 'orange'
|
||
|
|
|
||
|
|
inputs:
|
||
|
|
version:
|
||
|
|
description: >-
|
||
|
|
glint release tag to install (e.g. 'v0.2.28'). Defaults to 'latest'
|
||
|
|
which resolves to the newest published release.
|
||
|
|
required: false
|
||
|
|
default: 'latest'
|
||
|
|
file:
|
||
|
|
description: 'Path to the pipeline file to validate.'
|
||
|
|
required: false
|
||
|
|
default: '.gitlab-ci.yml'
|
||
|
|
args:
|
||
|
|
description: 'Additional arguments passed to glint check (e.g. --format sarif).'
|
||
|
|
required: false
|
||
|
|
default: ''
|
||
|
|
|
||
|
|
runs:
|
||
|
|
using: 'composite'
|
||
|
|
steps:
|
||
|
|
- name: Install glint
|
||
|
|
shell: bash
|
||
|
|
env:
|
||
|
|
GLINT_VERSION: ${{ inputs.version }}
|
||
|
|
run: |
|
||
|
|
set -euo pipefail
|
||
|
|
if [ "$GLINT_VERSION" = "latest" ]; then
|
||
|
|
GLINT_VERSION=$(curl -sf \
|
||
|
|
"https://git.k3nny.fr/api/v1/repos/k3nny/glint/releases?limit=1" \
|
||
|
|
| grep '"tag_name"' | head -1 | cut -d'"' -f4)
|
||
|
|
fi
|
||
|
|
DEST="$RUNNER_TEMP/glint-bin"
|
||
|
|
mkdir -p "$DEST"
|
||
|
|
URL="https://git.k3nny.fr/k3nny/glint/releases/download/${GLINT_VERSION}/glint-${GLINT_VERSION}-linux-amd64"
|
||
|
|
curl -sfL "$URL" -o "$DEST/glint"
|
||
|
|
chmod +x "$DEST/glint"
|
||
|
|
echo "$DEST" >> "$GITHUB_PATH"
|
||
|
|
"$DEST/glint" --version
|
||
|
|
|
||
|
|
- name: Run glint check
|
||
|
|
shell: bash
|
||
|
|
run: glint check ${{ inputs.args }} "${{ inputs.file }}"
|