Skip to content

cli: Add placeholder onboarding docs and sync context #12

cli: Add placeholder onboarding docs and sync context

cli: Add placeholder onboarding docs and sync context #12

name: Agnix config validation report
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
jobs:
agnix-config-validate:
name: Validate config with agnix
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: config
env:
AGNIX_VALIDATE_REPORT_PATH: ../context/tmp/ci-reports/agnix-validate-report.txt
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v31
- name: Run agnix validate and capture report
id: validate
shell: bash
run: |
set -euo pipefail
mkdir -p "$(dirname "$AGNIX_VALIDATE_REPORT_PATH")"
set +e
nix develop -c agnix validate . 2>&1 | tee "$AGNIX_VALIDATE_REPORT_PATH"
validate_exit=${PIPESTATUS[0]}
set -e
has_non_info=false
if grep -Eiq '\b(warning|error|fatal):' "$AGNIX_VALIDATE_REPORT_PATH"; then
has_non_info=true
fi
{
echo "validate_exit=$validate_exit"
echo "has_non_info=$has_non_info"
} >> "$GITHUB_OUTPUT"
- name: Upload agnix validation report artifact
if: steps.validate.outputs.has_non_info == 'true'
uses: actions/upload-artifact@v4
with:
name: agnix-validate-report
path: context/tmp/ci-reports/agnix-validate-report.txt
- name: Fail workflow on validation findings
if: always()
shell: bash
run: |
set -euo pipefail
if [ -z "${{ steps.validate.outputs.validate_exit }}" ] || [ "${{ steps.validate.outputs.validate_exit }}" -ne 0 ]; then
echo "agnix validate exited non-zero (${{ steps.validate.outputs.validate_exit }})"
exit 1
fi
if [ "${{ steps.validate.outputs.has_non_info }}" = "true" ]; then
echo "agnix validate reported non-info findings; see uploaded artifact."
exit 1
fi