From 99df4d9ccabe47559ef0d6c0d22a9b9225bf8acd Mon Sep 17 00:00:00 2001 From: ilia Date: Tue, 30 Dec 2025 22:01:38 -0500 Subject: [PATCH 1/3] Add CI for markdown and yaml --- .gitea/workflows/ci.yml | 95 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 .gitea/workflows/ci.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..0105334 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,95 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +jobs: + skip-ci-check: + runs-on: ubuntu-latest + outputs: + should_skip: ${{ steps.check.outputs.skip }} + steps: + - name: Checkout (for commit message) + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Skip check (@skipci in branch name or commit message) + id: check + shell: bash + run: | + set -euo pipefail + + SKIP_PATTERN='@skipci' + + # Branch name (works for push and PR on GitHub-compatible runners) + BRANCH_NAME="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" + + # Commit message (best-effort; fall back to git) + COMMIT_MSG="${GITHUB_EVENT_HEAD_COMMIT_MESSAGE:-}" + if [ -z "${COMMIT_MSG}" ]; then + COMMIT_MSG="$(git log -1 --pretty=%B 2>/dev/null || true)" + fi + + SKIP=0 + if echo "${BRANCH_NAME}" | grep -qiF "${SKIP_PATTERN}"; then + echo "Skipping CI: branch name contains ${SKIP_PATTERN}" + SKIP=1 + fi + + if [ "${SKIP}" -eq 0 ] && [ -n "${COMMIT_MSG}" ]; then + if echo "${COMMIT_MSG}" | grep -qiF "${SKIP_PATTERN}"; then + echo "Skipping CI: commit message contains ${SKIP_PATTERN}" + SKIP=1 + fi + fi + + echo "skip=${SKIP}" >> "${GITHUB_OUTPUT}" + echo "Branch: ${BRANCH_NAME}" + echo "Skip CI: ${SKIP}" + + markdown-lint: + needs: skip-ci-check + if: needs.skip-ci-check.outputs.should_skip != '1' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install markdownlint-cli2 + shell: bash + run: | + set -euo pipefail + npm install -g markdownlint-cli2@0.14.0 + + - name: Lint markdown + shell: bash + run: | + set -euo pipefail + # Lint tracked markdown files only (avoid linting generated/vendor content) + git ls-files '*.md' | xargs -r markdownlint-cli2 + + yaml-validate: + needs: skip-ci-check + if: needs.skip-ci-check.outputs.should_skip != '1' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install yamllint + shell: bash + run: | + set -euo pipefail + python3 -m pip install --user --no-cache-dir yamllint==1.35.1 + echo "$HOME/.local/bin" >> "$GITHUB_PATH" + + - name: Lint YAML + shell: bash + run: | + set -euo pipefail + # Lint tracked YAML only (avoid .git and other noise) + git ls-files '*.yml' '*.yaml' | xargs -r yamllint -d "{extends: default, rules: {line-length: disable}}" + -- 2.49.1 From 53188f39692a7f206fa98cd2178cda199a5ff281 Mon Sep 17 00:00:00 2001 From: ilia Date: Tue, 30 Dec 2025 22:24:59 -0500 Subject: [PATCH 2/3] Fix CI: venv yamllint + markdownlint config --- .gitea/workflows/ci.yml | 6 ++++-- .markdownlint-cli2.yaml | 4 ++++ README.md | 1 - 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .markdownlint-cli2.yaml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 0105334..39d70af 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -83,13 +83,15 @@ jobs: shell: bash run: | set -euo pipefail - python3 -m pip install --user --no-cache-dir yamllint==1.35.1 - echo "$HOME/.local/bin" >> "$GITHUB_PATH" + python3 -m venv .venv + . .venv/bin/activate + pip install --no-cache-dir yamllint==1.35.1 - name: Lint YAML shell: bash run: | set -euo pipefail # Lint tracked YAML only (avoid .git and other noise) + . .venv/bin/activate git ls-files '*.yml' '*.yaml' | xargs -r yamllint -d "{extends: default, rules: {line-length: disable}}" diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml new file mode 100644 index 0000000..ec6adb1 --- /dev/null +++ b/.markdownlint-cli2.yaml @@ -0,0 +1,4 @@ +# Notes repo: long lines (IPs, commands, URLs) are common. +config: + MD013: false + diff --git a/README.md b/README.md index d8110e4..cc0dc9c 100644 --- a/README.md +++ b/README.md @@ -22,4 +22,3 @@ Personal notes for my homelab: build logs, configs, and operational runbooks for This is an actively evolving notebook. Some sections may be incomplete or “work in progress”. - -- 2.49.1 From 8bcfddbb9790b8964f76a5aec3e78debc37e4bf6 Mon Sep 17 00:00:00 2001 From: ilia Date: Tue, 30 Dec 2025 22:34:00 -0500 Subject: [PATCH 3/3] Fix CI linting rules and trailing blanks --- .gitea/workflows/ci.yml | 4 ++-- .markdownlint-cli2.yaml | 2 +- README.md | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 39d70af..bdc7987 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -1,3 +1,4 @@ +--- name: CI on: @@ -93,5 +94,4 @@ jobs: set -euo pipefail # Lint tracked YAML only (avoid .git and other noise) . .venv/bin/activate - git ls-files '*.yml' '*.yaml' | xargs -r yamllint -d "{extends: default, rules: {line-length: disable}}" - + git ls-files '*.yml' '*.yaml' | xargs -r yamllint -d "{extends: default, rules: {document-start: disable, truthy: disable, line-length: disable}}" diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml index ec6adb1..b596eda 100644 --- a/.markdownlint-cli2.yaml +++ b/.markdownlint-cli2.yaml @@ -1,4 +1,4 @@ +--- # Notes repo: long lines (IPs, commands, URLs) are common. config: MD013: false - diff --git a/README.md b/README.md index cc0dc9c..ae24756 100644 --- a/README.md +++ b/README.md @@ -21,4 +21,3 @@ Personal notes for my homelab: build logs, configs, and operational runbooks for ## Status This is an actively evolving notebook. Some sections may be incomplete or “work in progress”. - -- 2.49.1