SpyglassMC Action
This action lets you validate your Minecraft datapack using [SpyglassMC](https://spyglassmc.com/).
All JSON and MCFunction files are checked for syntax errors.
Table of Contents
---
- [Basic workflow](#basic-workflow)
- [Input parameters](#input-parameters)
- [GitHub vs. Gitea](#github-vs-gitea)
- [Gitea](#gitea)
- [GitHub](#github)
---
## Basic workflow
Here is a simple example showing how to use this action:
```yaml
name: Check datapack
on:
pull_request:
branches:
- main
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check syntax and schemas
uses: https://git.kb28.ch/HEL/spyglassmc-action@v1.1.3
```
## Input parameters
The following parameters can be passed using the `with` section:
|Parameter|Type|Default|Description|
|:---|:---|:---:|:---|
|`rootDir` |Path |`./` |Root datapack directory (containing the data folder and pack.mcmeta file)|
|`version` |String |`auto` |The Minecraft version to use. If not specified or set to 'auto', will try to use the version indicated in `pack.mcmeta`|
|`reportAllErrors`|Boolean|`false`|Whether to report all errors or only the first one|
|`verbose` |Boolean|`false`|Whether to provide details on errors or just the number of errors|
## GitHub vs. Gitea
Depending on where you want to execute this action, you should be mindful of the following points
### Gitea
If your workflow will be running on Gitea, you might need to set a specific runner image (see https://gitea.com/gitea/runner-images#migration). For example:
```yaml
...
jobs:
check:
runs-on: ubuntu-latest
container: catthehacker/ubuntu:act-latest
...
```
### GitHub
If your workflow will be running on GitHub, you will not be able to simply use the action from this Gitea repository.\
Instead, you need to add a step to clone this repository, and use the action locally
```yaml
name: Check datapack
on:
pull_request:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Checkout action
run: |
git clone https://git.kb28.ch/HEL/spyglassmc-action ./.github/actions/spyglassmc-action
- name: Check syntax and schemas
uses: ./.github/actions/spyglassmc-action
```
You might also want to `git checkout` a specific tagged version