feat(ci): validate justfiles (#784)

This commit is contained in:
renner 2025-08-04 17:42:36 +02:00 committed by GitHub
parent babbf7de5e
commit 2ed06b388f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 55 additions and 1 deletions

View file

@ -0,0 +1,11 @@
#!/bin/bash
set -eoux pipefail
ARCH=$(uname -m)
while [[ "${JUST_VERSION:-}" =~ null || -z "${JUST_VERSION:-}" ]]
do
JUST_VERSION=$(curl -L https://api.github.com/repos/casey/just/releases/latest | jq -r '.tag_name')
done
curl -sSLO https://github.com/casey/just/releases/download/"${JUST_VERSION}"/just-"${JUST_VERSION}"-"${ARCH}"-unknown-linux-musl.tar.gz
tar -zxvf just-"${JUST_VERSION}"-"${ARCH}"-unknown-linux-musl.tar.gz -C /tmp just
sudo mv /tmp/just /usr/local/bin/just
rm -f just-"${JUST_VERSION}"-"${ARCH}"-unknown-linux-musl.tar.gz

29
.github/workflows/validate-just.yml vendored Normal file
View file

@ -0,0 +1,29 @@
name: Validate Justfiles
on:
pull_request:
paths:
- "Justfile"
- "**/*.just"
push:
branches:
- main
paths:
- "Justfile"
- "**/*.just"
jobs:
validate-just:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Install Just
shell: bash
run: bash .github/workflows/shared/install-just.sh
- name: Check Just Syntax
shell: bash
run: |
just check

View file

@ -14,7 +14,7 @@ renovate dry-run="lookup" log-level="debug":
echo "Warning: No Github token found, renovate will nag at you for this."
echo "Set it with GITHUB_COM_TOKEN=(your token)"
fi
LOG_LEVEL=${LOG_LEVEL:-debug} renovate --platform=local --dry-run={{dry-run}}
LOG_LEVEL=${LOG_LEVEL:-debug} renovate --platform=local --dry-run={{ dry-run }}
echo "Updates can be found in a section of the logs called \"packageFiles with updates\""
build $spec *MOCK_ARGS:
@ -134,3 +134,17 @@ clean:
sudo rm -ri $line
done
exit 0
# Check Just Syntax
just := just_executable()
[group('Just')]
check:
#!/usr/bin/bash
find . -type f -name "*.just" | while read -r file; do
echo "Checking syntax: $file"
{{ just }} --unstable --fmt --check -f $file
done
echo "Checking syntax: Justfile"
{{ just }} --unstable --fmt --check -f Justfile