Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Actionlint Directly Invokable as an Action Itself #479

Closed
wants to merge 172 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
172 commits
Select commit Hold shift + click to select a range
59bb801
Add github actions aware error and logging functions
norwd Jan 15, 2023
37bed26
Replace naked `echo` calls with new logging methods
norwd Jan 15, 2023
d25c1b0
Create action.yml
norwd Jan 15, 2023
ab96300
Use quotes to prevent `:` from being detected as yaml syntax
norwd Jan 15, 2023
9a50767
Add input for enabling colourful output
norwd Jan 15, 2023
6d048d7
Fix formatting call
norwd Jan 15, 2023
ddb13aa
Format entire warning string
norwd Jan 15, 2023
ebf9af5
Quote invalid value instead of appending after `:`
norwd Jan 15, 2023
dbc540c
Fix incorrectly specified `--color` when explicitly disabled
norwd Jan 15, 2023
a626b14
Add example workflow
norwd Jan 15, 2023
1120e49
Add `--color` to example
norwd Jan 15, 2023
2045f7c
Fix SC2145: Argument mixes string and array. Use * or separate argument.
norwd Jan 15, 2023
a4d4cf6
Merge branch 'rhysd:main' into main
norwd Feb 15, 2023
f9634c0
Merge branch 'rhysd:main' into main
norwd Feb 23, 2023
06c981a
Merge branch 'rhysd:main' into main
norwd Apr 1, 2023
7f1803f
Merge branch 'rhysd:main' into main
norwd Apr 1, 2023
99cf598
Merge branch 'rhysd:main' into main
norwd Apr 2, 2023
5ef2ef6
Merge branch 'rhysd:main' into main
norwd Apr 3, 2023
38276fe
Merge branch 'rhysd:main' into main
norwd Apr 4, 2023
1ed67bd
Merge branch 'rhysd:main' into main
norwd Apr 9, 2023
7861403
Merge branch 'rhysd:main' into main
norwd Apr 9, 2023
ad86d7e
Merge branch 'rhysd:main' into main
norwd Apr 10, 2023
f20f16f
Merge branch 'rhysd:main' into main
norwd Jun 2, 2023
f424988
Merge branch 'rhysd:main' into main
norwd Jun 2, 2023
8f9bd0f
Merge branch 'rhysd:main' into main
norwd Jun 2, 2023
9558429
Merge branch 'rhysd:main' into main
norwd Jun 3, 2023
72aa04e
Merge branch 'rhysd:main' into main
norwd Jun 4, 2023
e308890
Merge branch 'rhysd:main' into main
norwd Jun 5, 2023
35f4950
Merge branch 'rhysd:main' into main
norwd Jun 6, 2023
b2b2cf3
Merge branch 'rhysd:main' into main
norwd Jun 7, 2023
088f127
Merge branch 'rhysd:main' into main
norwd Jun 8, 2023
c6b821f
Merge branch 'rhysd:main' into main
norwd Jun 9, 2023
4b841c1
Merge branch 'rhysd:main' into main
norwd Jun 10, 2023
f439d96
Merge branch 'rhysd:main' into main
norwd Jun 10, 2023
9e3a6f3
Merge branch 'rhysd:main' into main
norwd Jun 10, 2023
d135ebf
Merge branch 'rhysd:main' into main
norwd Jun 10, 2023
eb1d84a
Merge branch 'rhysd:main' into main
norwd Jun 11, 2023
0eeae2c
Merge branch 'rhysd:main' into main
norwd Jun 12, 2023
ed92b36
Merge branch 'rhysd:main' into main
norwd Jun 14, 2023
2803931
Merge branch 'rhysd:main' into main
norwd Jun 15, 2023
234d625
Merge branch 'rhysd:main' into main
norwd Jun 15, 2023
bb55bb8
Merge branch 'rhysd:main' into main
norwd Jun 15, 2023
b26d3e7
Merge branch 'rhysd:main' into main
norwd Jun 17, 2023
11ca5af
Merge branch 'rhysd:main' into main
norwd Jun 19, 2023
9de2413
Merge branch 'rhysd:main' into main
norwd Jun 20, 2023
aa74403
Merge branch 'rhysd:main' into main
norwd Jun 21, 2023
e98485e
Merge branch 'rhysd:main' into main
norwd Jun 22, 2023
7562b96
Merge branch 'rhysd:main' into main
norwd Jun 23, 2023
f1298af
Merge branch 'rhysd:main' into main
norwd Jun 24, 2023
d1f5008
Merge branch 'rhysd:main' into main
norwd Jun 24, 2023
1a53640
Merge branch 'rhysd:main' into main
norwd Jun 27, 2023
aadc5d1
Merge branch 'rhysd:main' into main
norwd Jun 28, 2023
d79f4b3
Merge branch 'rhysd:main' into main
norwd Jun 29, 2023
3815677
Merge branch 'rhysd:main' into main
norwd Jun 30, 2023
526682b
Merge branch 'rhysd:main' into main
norwd Jul 1, 2023
d51d44d
Merge branch 'rhysd:main' into main
norwd Jul 1, 2023
63ad63f
Merge branch 'rhysd:main' into main
norwd Jul 2, 2023
31505b2
Merge branch 'rhysd:main' into main
norwd Jul 5, 2023
44fbffd
Merge branch 'rhysd:main' into main
norwd Jul 7, 2023
e9939cf
Merge branch 'rhysd:main' into main
norwd Jul 8, 2023
7e19671
Merge branch 'rhysd:main' into main
norwd Jul 12, 2023
8b0888c
Merge branch 'rhysd:main' into main
norwd Jul 13, 2023
02a2ea8
Merge branch 'rhysd:main' into main
norwd Jul 14, 2023
8094886
Merge branch 'rhysd:main' into main
norwd Jul 15, 2023
3f3e852
Merge branch 'rhysd:main' into main
norwd Jul 16, 2023
98dc2fb
Merge branch 'rhysd:main' into main
norwd Jul 17, 2023
f67f40c
Merge branch 'rhysd:main' into main
norwd Jul 18, 2023
7d5f2d7
Merge branch 'rhysd:main' into main
norwd Jul 22, 2023
fefb63b
Merge branch 'rhysd:main' into main
norwd Jul 23, 2023
2e96fc1
Merge branch 'rhysd:main' into main
norwd Jul 23, 2023
47ddbf3
Merge branch 'rhysd:main' into main
norwd Jul 29, 2023
b5de33a
Merge branch 'rhysd:main' into main
norwd Jul 31, 2023
22e7217
Merge branch 'rhysd:main' into main
norwd Aug 1, 2023
ef13e05
Merge branch 'rhysd:main' into main
norwd Aug 1, 2023
f6c715f
Merge branch 'rhysd:main' into main
norwd Aug 1, 2023
f599396
Merge branch 'rhysd:main' into main
norwd Aug 2, 2023
b70d215
Merge branch 'rhysd:main' into main
norwd Aug 2, 2023
421f9be
Merge branch 'rhysd:main' into main
norwd Aug 3, 2023
4daff3c
Merge branch 'rhysd:main' into main
norwd Aug 4, 2023
06cf369
Merge branch 'rhysd:main' into main
norwd Aug 4, 2023
a2ee53e
Merge branch 'rhysd:main' into main
norwd Aug 5, 2023
b8fe371
Merge branch 'rhysd:main' into main
norwd Aug 5, 2023
9654d70
Merge branch 'rhysd:main' into main
norwd Aug 5, 2023
6782952
Merge branch 'rhysd:main' into main
norwd Aug 6, 2023
262f18f
Merge branch 'rhysd:main' into main
norwd Aug 6, 2023
1982b8b
Merge branch 'rhysd:main' into main
norwd Aug 12, 2023
bc29960
Merge branch 'rhysd:main' into main
norwd Aug 19, 2023
6aedfef
Merge branch 'rhysd:main' into main
norwd Sep 4, 2023
6f00402
Merge branch 'rhysd:main' into main
norwd Sep 10, 2023
d650dae
Merge branch 'rhysd:main' into main
norwd Sep 18, 2023
72e5552
Merge branch 'rhysd:main' into main
norwd Sep 18, 2023
b66738e
Merge branch 'rhysd:main' into main
norwd Sep 18, 2023
30ce8fd
Merge branch 'rhysd:main' into main
norwd Sep 21, 2023
89cd8fa
Merge branch 'rhysd:main' into main
norwd Sep 23, 2023
2475be1
Merge branch 'rhysd:main' into main
norwd Sep 30, 2023
04bb6dc
Merge branch 'rhysd:main' into main
norwd Oct 2, 2023
e633f87
Merge branch 'rhysd:main' into main
norwd Oct 10, 2023
d3de19e
Merge branch 'rhysd:main' into main
norwd Oct 27, 2023
193c96d
Merge branch 'rhysd:main' into main
norwd Nov 1, 2023
1bc77db
Merge branch 'rhysd:main' into main
norwd Nov 11, 2023
999740d
Merge branch 'rhysd:main' into main
norwd Feb 7, 2024
8545222
Merge branch 'rhysd:main' into main
norwd Feb 7, 2024
2311ec2
Merge branch 'rhysd:main' into main
norwd Feb 8, 2024
fbff403
Merge branch 'rhysd:main' into main
norwd Feb 9, 2024
5f21d87
Merge branch 'rhysd:main' into main
norwd Feb 9, 2024
bcb8db9
Merge branch 'rhysd:main' into main
norwd Feb 10, 2024
3fb7c7b
Merge branch 'rhysd:main' into main
norwd Feb 10, 2024
b9186c6
Merge branch 'rhysd:main' into main
norwd Feb 11, 2024
9e34ae7
Merge branch 'rhysd:main' into main
norwd Feb 14, 2024
430ba3d
Merge branch 'rhysd:main' into main
norwd Feb 15, 2024
7aa1b40
Merge branch 'rhysd:main' into main
norwd Feb 16, 2024
a56bca3
Merge branch 'rhysd:main' into main
norwd Feb 16, 2024
9e31b15
Merge branch 'rhysd:main' into main
norwd Feb 16, 2024
0b49f51
Merge branch 'rhysd:main' into main
norwd Feb 16, 2024
b52f0a9
Merge branch 'rhysd:main' into main
norwd Feb 17, 2024
4b08d9f
update versions in usage document by bump-version.bash
rhysd Feb 17, 2024
fa96836
Merge branch 'rhysd:main' into main
norwd Feb 17, 2024
dbcd8c5
Merge branch 'rhysd:main' into main
norwd Feb 17, 2024
22b67aa
Merge branch 'rhysd:main' into main
norwd Feb 18, 2024
92eceed
Merge branch 'rhysd:main' into main
norwd Feb 22, 2024
8c43ea4
Merge branch 'rhysd:main' into main
norwd Feb 23, 2024
8cecdc2
Merge branch 'rhysd:main' into main
norwd Feb 24, 2024
05915e3
Merge branch 'rhysd:main' into main
norwd Feb 24, 2024
483bbb0
Merge branch 'rhysd:main' into main
norwd Feb 24, 2024
39ffde8
Merge branch 'rhysd:main' into main
norwd Feb 25, 2024
a1ca1fa
Merge branch 'rhysd:main' into main
norwd Feb 26, 2024
cc632a6
Merge branch 'rhysd:main' into main
norwd Feb 26, 2024
bd6b37f
Merge branch 'rhysd:main' into main
norwd Feb 27, 2024
13929a1
Merge branch 'rhysd:main' into main
norwd Feb 28, 2024
f4488a1
Merge branch 'rhysd:main' into main
norwd Feb 28, 2024
e97cb00
Merge branch 'rhysd:main' into main
norwd Feb 29, 2024
313b82f
Merge branch 'rhysd:main' into main
norwd Mar 1, 2024
a98378b
Merge branch 'rhysd:main' into main
norwd Mar 2, 2024
91e14a9
Merge branch 'rhysd:main' into main
norwd Mar 2, 2024
f2643c9
Merge branch 'rhysd:main' into main
norwd Mar 3, 2024
c5d6e36
Merge branch 'rhysd:main' into main
norwd Mar 4, 2024
5841426
Merge branch 'rhysd:main' into main
norwd Mar 5, 2024
6b31e01
Merge branch 'rhysd:main' into main
norwd Mar 5, 2024
c5cc297
Merge branch 'rhysd:main' into main
norwd Mar 6, 2024
8c158b6
Merge branch 'rhysd:main' into main
norwd Mar 6, 2024
a270bc4
Merge branch 'rhysd:main' into main
norwd Mar 7, 2024
a01a963
Merge branch 'rhysd:main' into main
norwd Mar 7, 2024
f575a73
Merge branch 'rhysd:main' into main
norwd Mar 8, 2024
ebc6786
Merge branch 'rhysd:main' into main
norwd Mar 9, 2024
1df5482
Merge branch 'rhysd:main' into main
norwd Mar 11, 2024
3e7a8c5
Merge branch 'rhysd:main' into main
norwd Mar 11, 2024
326a165
Merge branch 'rhysd:main' into main
norwd Mar 12, 2024
fe5c14d
Merge branch 'rhysd:main' into main
norwd Mar 12, 2024
b2f25bf
Merge branch 'rhysd:main' into main
norwd Mar 12, 2024
b966196
Merge branch 'rhysd:main' into main
norwd Mar 13, 2024
8c0badf
Merge branch 'rhysd:main' into main
norwd Mar 13, 2024
73017b2
Merge branch 'rhysd:main' into main
norwd Mar 14, 2024
6c6a587
Merge branch 'rhysd:main' into main
norwd Mar 14, 2024
2f73df5
Merge branch 'rhysd:main' into main
norwd Mar 15, 2024
8db9720
Merge branch 'rhysd:main' into main
norwd Mar 16, 2024
a59130d
Merge branch 'rhysd:main' into main
norwd Mar 17, 2024
ffb3284
Merge branch 'rhysd:main' into main
norwd Mar 18, 2024
acfb34c
Merge branch 'rhysd:main' into main
norwd Mar 19, 2024
515cce7
Merge branch 'rhysd:main' into main
norwd Mar 21, 2024
c57c71e
Merge branch 'rhysd:main' into main
norwd Mar 22, 2024
df8ac32
Merge branch 'rhysd:main' into main
norwd Mar 23, 2024
52b060f
Merge branch 'rhysd:main' into main
norwd Mar 23, 2024
cd8e3b1
Merge branch 'rhysd:main' into main
norwd Mar 26, 2024
1318671
Merge branch 'rhysd:main' into main
norwd Apr 6, 2024
8d3d559
Merge branch 'rhysd:main' into main
norwd Apr 10, 2024
76067b6
Merge branch 'rhysd:main' into main
norwd Apr 10, 2024
641ba01
Merge branch 'rhysd:main' into main
norwd Apr 12, 2024
fdf9d5a
add tests for parsing pyflakes output
rhysd Apr 15, 2024
a9f1837
Merge branch 'rhysd:main' into main
norwd Apr 15, 2024
c5e49e7
Merge branch 'main' into some-point-before-the-fork
norwd Nov 18, 2024
1d31ac4
Merge pull request #3 from norwd/some-point-before-the-fork
norwd Nov 18, 2024
3aca46a
Fix merge conflict
norwd Nov 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---

name: actionlint
description: ":octocat: Static checker for GitHub Actions workflow files"

#branding: # https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#branding
# icon: _
# color: _

inputs:
color:
default: false
description: "Enable colorful output."

runs:
using: composite
steps:
- name: "Report Invalid Color Input"
if: inputs.color != 'yes' && inputs.color != 'true' && inputs.color != 'no' && inputs.color != 'false'
shell: bash
run: echo ${{ format('::warning::Invalid boolean value for color "{0}"', inputs.color) }}

- name: "Download Action Lint"
shell: bash
run: ${{ github.action_path }}/scripts/download-actionlint.bash latest ${{ runner.temp }}

- name: "Run Action Lint"
shell: bash
run: ${{ runner.temp }}/actionlint ${{ (inputs.color == 'yes' || inputs.color == 'true') && '-color' || '' }}
17 changes: 17 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,21 @@ Go APIs are available. See [the Go API document](api.md) for more details.
<a id="tools-integ"></a>
## Tools integration

### GitHub Actions

[actionlint](..) is itself integrated with GitHub Actions. It can be run directly from a simple workflow file.

```yaml
name: actionlint
on: push
jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: rhysd/[email protected]
```

### reviewdog

[reviewdog][] is an automated review tool for various code hosting services. It officially [supports actionlint][reviewdog-actionlint].
Expand All @@ -323,6 +338,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-actionlint@v1
with:
color: true
```

<a id="problem-matchers"></a>
Expand Down
45 changes: 34 additions & 11 deletions scripts/download-actionlint.bash
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,29 @@ function usage() {
echo ' $ bash download-actionlint.bash 1.6.9 /usr/bin' >&2
}

log() {
if [ "${GITHUB_ACTIONS}" ]
then
echo "::notice::$*"
else
echo "$@" 1>&2
fi
}

err() {
if [ "${GITHUB_ACTIONS}" ]
then
echo "::error::$*"
else
echo "$@" 1>&2
fi
}

die() {
err "$*"
exit 1
}

if [[ "$1" == "-h" || "$1" == "--help" ]]; then
usage
exit
Expand All @@ -49,7 +72,8 @@ if [ -n "$1" ]; then
if [[ "$1" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
version="$1"
else
echo "Given version '$1' does not match to regex '^[0-9]+\.[0-9]+\.[0-9]+$' nor equal to 'latest'" >&2
err "Given version '$1' does not match to regex '^[0-9]+\.[0-9]+\.[0-9]+$' nor equal to 'latest'"

echo >&2
usage
exit 1
Expand All @@ -62,14 +86,15 @@ if [ -n "$2" ]; then
if [ -d "$2" ]; then
target_dir="${2%/}"
else
echo "Directory '$2' does not exist" >&2
err "Directory '$2' does not exist"

echo >&2
usage
exit 1
fi
fi

echo "Start downloading actionlint v${version} to ${target_dir}"
log "Start downloading actionlint v${version} to ${target_dir}"

case "$OSTYPE" in
linux-*)
Expand All @@ -89,8 +114,7 @@ case "$OSTYPE" in
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
die "OS '${OSTYPE}' is not supported. Note: If you're using Windows, please ensure bash is used to run this script"
;;
esac

Expand All @@ -102,18 +126,17 @@ case "$machine" in
aarch64|arm64) arch=arm64 ;;
arm*) arch=armv6 ;;
*)
echo "Could not determine arch from machine hardware name '${machine}'" >&2
exit 1
die "Could not determine arch from machine hardware name '${machine}'"
;;
esac

echo "Detected OS=${os} ext=${ext} arch=${arch}"
log "Detected OS=${os} ext=${ext} arch=${arch}"

# https://github.com/rhysd/actionlint/releases/download/v1.0.0/actionlint_1.0.0_linux_386.tar.gz
file="actionlint_${version}_${os}_${arch}.${ext}"
url="https://github.com/rhysd/actionlint/releases/download/v${version}/${file}"

echo "Downloading ${url} with curl"
log "Downloading ${url} with curl"

if [[ "$os" == "windows" ]]; then
tempdir="$(mktemp -d actionlint.XXXXXXXXXXXXXXXX)"
Expand All @@ -126,9 +149,9 @@ else
exe="$target_dir/actionlint"
fi

echo "Downloaded and unarchived executable: ${exe}"
log "Downloaded and unarchived executable: ${exe}"

echo "Done: $("${exe}" -version)"
log "Done: $("${exe}" -version)"

if [ -n "$GITHUB_ACTION" ]; then
# On GitHub Actions, set executable path to output
Expand Down
Loading