Files
Content-Monorepo/.forgejo/workflows/linter.yml
2026-04-18 15:26:44 -06:00

73 lines
2.1 KiB
YAML

name: "Linter"
on:
push:
branches: ["main"]
paths:
- 'modpacks/**/*.json'
- 'modpacks/**/*.mcmeta'
- 'modpacks/**/*.toml'
- 'datapacks/**/*.json'
- 'datapacks/**/*.mcmeta'
- 'src/actions/somnus/**'
pull_request:
branches: ["main"]
paths:
- 'modpacks/**/*.json'
- 'modpacks/**/*.mcmeta'
- 'modpacks/**/*.toml'
- 'datapacks/**/*.json'
- 'datapacks/**/*.mcmeta'
- 'src/actions/somnus/**'
workflow_dispatch:
jobs:
lint:
runs-on: technocality
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 2
filter: blob:none
sparse-checkout: |
modpacks
datapacks
src/actions/somnus
- name: Cache Linter Binaries
id: cache-linter
uses: actions/cache@v4
with:
path: ./linter-bin
key: linter-v1-${{ runner.os }}-${{ hashFiles('src/actions/somnus/core/**/*.rs', 'src/actions/somnus/core/Cargo.toml', 'src/actions/somnus/core/Cargo.lock') }}
- name: Rust Cache
if: steps.cache-linter.outputs.cache-hit != 'true'
uses: https://github.com/Swatinem/rust-cache@v2
with:
workspaces: "src/actions/somnus/core -> target"
- name: Install Rust
if: steps.cache-linter.outputs.cache-hit != 'true'
uses: https://github.com/dtolnay/rust-toolchain@stable
- name: Build Linters
if: steps.cache-linter.outputs.cache-hit != 'true'
run: |
cargo build --release \
--manifest-path src/actions/somnus/core/Cargo.toml \
--bin json-linter --bin toml-linter
mkdir -p ./linter-bin
cp src/actions/somnus/core/src/bin/json-linter ./linter-bin/
cp src/actions/somnus/core/src/bin/toml-linter ./linter-bin/
- name: Run Linters
run: |
chmod +x ./linter-bin/json-linter ./linter-bin/toml-linter
echo "Running JSON Linter..."
./linter-bin/json-linter
echo "Running TOML Linter..."
./linter-bin/toml-linter