-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
69 lines (63 loc) · 1.92 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
name: Check minecraft commands
author: Valentin Berlier <berlier.v@gmail.com>
description: Github action to validate minecraft data packs and function files.
branding:
icon: check-square
color: red
inputs:
version:
description: The version of mecha to install
required: true
default: "latest"
source:
description: The list of data packs, functions files or folders to validate
required: true
minecraft:
description: The version of minecraft to use for checking commands
required: true
default: "1.19"
stats:
description: Whether to output statistics
required: true
default: "false"
log:
description: The output log level
required: true
default: "WARNING"
runs:
using: composite
steps:
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Setup cache
id: cache-mecha-venv
uses: actions/cache@v3
with:
path: ~/.mecha_venv
key: mecha-venv-${{ runner.os }}-${{ inputs.version }}
- name: Run mecha
env:
CACHE_HIT: ${{ steps.cache-mecha-venv.outputs.cache-hit }}
MECHA_VERSION: ${{ inputs.version }}
MECHA_SOURCE: ${{ inputs.source }}
MECHA_MINECRAFT: ${{ inputs.minecraft }}
MECHA_STATS: ${{ inputs.stats == 'true' && '--stats' || '' }}
MECHA_LOG: ${{ inputs.log }}
run: |
if [ "$CACHE_HIT" != "true" ] || [ ! -f ~/.mecha_venv/bin/python ]; then
rm -rf ~/.mecha_venv
python -m venv ~/.mecha_venv
source ~/.mecha_venv/bin/activate
if [ "$MECHA_VERSION" == "latest" ]; then
pip install mecha
else
pip install "mecha==$MECHA_VERSION"
fi
else
source ~/.mecha_venv/bin/activate
fi
shopt -s extglob
mecha $MECHA_SOURCE --minecraft "$MECHA_MINECRAFT" --log "$MECHA_LOG" $MECHA_STATS
shell: bash