From 02f74ce659329f3b9a1d0a77553bb1bfde4911e1 Mon Sep 17 00:00:00 2001 From: jv Date: Thu, 17 Sep 2026 23:19:16 -0500 Subject: [PATCH] fix: clean up workflow duplication and syntax --- .gitea/workflows/homelab-main.yml | 33 ++++++++++--------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/.gitea/workflows/homelab-main.yml b/.gitea/workflows/homelab-main.yml index 656e249..a72f66b 100644 --- a/.gitea/workflows/homelab-main.yml +++ b/.gitea/workflows/homelab-main.yml @@ -10,40 +10,27 @@ jobs: validate: runs-on: k8s container: node:18-bullseye - container: - image: node:18-bullseye - steps: - name: Check out repository uses: actions/checkout@v4 with: ref: ${{ gitea.sha }} - uses: actions/checkout@v4 - with: - ref: ${{ gitea.sha }} - name: Validate repository run: | set -euo pipefail - ./jeannie validate deploy: runs-on: k8s container: node:18-bullseye - container: - image: node:18-bullseye needs: - validate if: ${{ gitea.ref == 'refs/heads/main' }} - steps: - name: Check out repository uses: actions/checkout@v4 with: ref: ${{ gitea.sha }} - uses: actions/checkout@v4 - with: - ref: ${{ gitea.sha }} - name: Block automatic deploy for external Gitea changes run: | set -euo pipefail @@ -80,15 +67,15 @@ jobs: def function_ranges(content): starts = [] for index, line in enumerate(content.splitlines(), 1): - match = re.match(r"^([A-Za-z_][A-Za-z0-9_]*)\(\) \{", line) - if match: - starts.append((index, match.group(1))) + match = re.match(r"^([A-Za-z_][A-Za-z0-9_]*)\(\) \{", line) + if match: + starts.append((index, match.group(1))) ranges = [] for offset, (start, name) in enumerate(starts): - end = starts[offset + 1][0] - 1 if offset + 1 < len(starts) else len(content.splitlines()) - if name in target_functions: - ranges.append((start, end)) + end = starts[offset + 1][0] - 1 if offset + 1 < len(starts) else len(content.splitlines()) + if name in target_functions: + ranges.append((start, end)) return ranges @@ -112,22 +99,22 @@ jobs: def overlaps(start, length, ranges): if length == 0: - end = start + end = start else: - end = start + length - 1 + end = start + length - 1 return any(start <= range_end and end >= range_start for range_start, range_end in ranges) for line in diff.splitlines(): match = re.match(r"^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@", line) if not match: - continue + continue old_start = int(match.group(1)) old_length = int(match.group(2) or "1") new_start = int(match.group(3)) new_length = int(match.group(4) or "1") if overlaps(old_start, old_length, base_ranges) or overlaps(new_start, new_length, current_ranges): - sys.exit(0) + sys.exit(0) sys.exit(1) PY