-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yaml
More file actions
37 lines (33 loc) · 1.14 KB
/
action.yaml
File metadata and controls
37 lines (33 loc) · 1.14 KB
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
---
name: 'Format check ArkScript code'
description: 'Given a folder, find all .ark files and check that they are correctly formatted'
inputs:
folder:
description: 'Folder with .ark files to check'
required: true
runs:
using: 'composite'
steps:
- name: Download ArkScript latest release
shell: sh
run: |
VERSION=linux-gcc-14
wget -q $(curl -s https://api.github.com/repos/ArkScript-lang/Ark/releases?per_page=1 | grep "browser_download_url.*${VERSION}.zip" | cut -d : -f 2,3 | tr -d \")
unzip -o ${VERSION}.zip
chmod u+x ./arkscript
./arkscript --version
- name: Check
shell: bash
run: |
path=${{ inputs.folder }}
failures=0
while read -rd $'\0' file; do
if ! ./arkscript --format "$file" --check; then
echo "❌ $(basename $file) is not formatted correctly"
failures=$((failures+1))
else
echo "✅ $(basename $file)"
fi
done < <(find "${path%/}" -type f -name "*.ark" -print0)
echo "$failures file(s) need to be formatted"
[ $failures -gt 0 ] && exit 1 || exit 0