-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
84 lines (80 loc) · 2.52 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: 'Actionlint Action'
description: 'Install actionlint and run it on all workflow files'
author: 'eifinger'
inputs:
version:
description: 'The version of actionlint to install'
required: false
default: '1.7.7'
checksum:
description: 'The checksum of the actionlint binary'
required: false
runs:
using: composite
steps:
- name: Install actionlint
run: |
case "$OSTYPE" in
linux-*)
os=linux
ext=tar.gz
;;
darwin*)
os=darwin
ext=tar.gz
;;
freebsd*)
os=freebsd
ext=tar.gz
;;
msys|cygwin|win32)
os=windows
ext=zip
;;
*)
echo "OS '${OSTYPE}' is not supported. Note: If you're using Windows, please ensure bash is used to run this script" >&2
exit 1
;;
esac
machine="$(uname -m)"
case "$machine" in
x86_64) arch=amd64 ;;
i?86) arch=386 ;;
aarch64|arm64) arch=arm64 ;;
arm*) arch=armv6 ;;
*)
echo "Could not determine arch from machine hardware name '${machine}'" >&2
exit 1
;;
esac
echo "Detected OS=${os} ext=${ext} arch=${arch}"
file="actionlint_${VERSION}_${os}_${arch}.${ext}"
url="https://github.com/rhysd/actionlint/releases/download/v${VERSION}/${file}"
curl -L -o "${file}" "${url}"
if ! sha256sum -c ${GITHUB_ACTION_PATH}/checksums.txt --ignore-missing --status;
then
echo "No known checksum matches. Checking for supplied checksums..."
if [[ ! -z "$CHECKSUM" ]]; then
echo "${CHECKSUM} ${file}" | sha256sum -c
else
echo ::warning title=Unvalidated binary::No checksums could be found to validate ${file}. Please consider adding a checksum via the checksum input.
fi
fi
if [[ "$os" == "windows" ]]; then
unzip "${file}" actionlint.exe
else
tar xzf "${file}" actionlint
fi
shell: bash
env:
VERSION: ${{ inputs.version }}
CHECKSUM: ${{ inputs.checksum }}
- name: Add Matcher
run: echo "::add-matcher::${GITHUB_ACTION_PATH}/matchers/actionlint.json"
shell: bash
- name: Lint GitHub Action Workflows
run: ./actionlint -color
shell: bash
branding:
icon: 'check'
color: 'green'