Skip to content

Commit dd5a359

Browse files
committed
Add action.yml
1 parent c66a3ad commit dd5a359

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

action.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Check minecraft commands
2+
author: Valentin Berlier <berlier.v@gmail.com>
3+
description: Github action to validate minecraft data packs and function files.
4+
5+
branding:
6+
icon: check-square
7+
color: red
8+
9+
inputs:
10+
version:
11+
description: The version of mecha to install
12+
required: true
13+
default: 'latest'
14+
source:
15+
description: The list of data packs, functions files or folders to validate
16+
required: true
17+
minecraft:
18+
description: The version of minecraft to use for checking commands
19+
required: true
20+
default: '1.17'
21+
log:
22+
description: The output log level
23+
required: true
24+
default: 'WARNING'
25+
26+
runs:
27+
using: composite
28+
steps:
29+
- name: Setup python
30+
uses: actions/setup-python@v2
31+
with:
32+
python-version: '3.9'
33+
- name: Setup cache
34+
id: cached-mecha-venv
35+
uses: actions/cache@v2
36+
with:
37+
path: ~/.mecha_venv
38+
key: mecha-venv-${{ runner.os }}-${{ inputs.version }}
39+
- name: Install mecha
40+
if: steps.cached-mecha-venv.outputs.cache-hit != 'true'
41+
env:
42+
MECHA_VERSION: ${{ inputs.version }}
43+
run: |
44+
if [ ! -d ~/.mecha_venv ]; then
45+
python -m venv ~/.mecha_venv
46+
fi
47+
source ~/.mecha_venv/bin/activate
48+
if [ "$MECHA_VERSION" == "latest" ]; then
49+
pip install mecha
50+
else
51+
pip install "mecha==$MECHA_VERSION"
52+
fi
53+
shell: bash
54+
- name: Run mecha
55+
env:
56+
MECHA_SOURCE: ${{ inputs.source }}
57+
MECHA_MINECRAFT: ${{ inputs.minecraft }}
58+
MECHA_LOG: ${{ inputs.log }}
59+
run: |
60+
source ~/.mecha_venv/bin/activate
61+
mecha $MECHA_SOURCE --minecraft "$MECHA_MINECRAFT" --log "$MECHA_LOG"
62+
shell: bash

0 commit comments

Comments
 (0)