fix: clean up workflow duplication and syntax
Homelab Main / validate (push) Failing after 1m17s Details
Homelab Main / deploy (push) Has been skipped Details

This commit is contained in:
jv 2026-09-17 23:19:16 -05:00
parent e635e73e2b
commit 02f74ce659
1 changed files with 10 additions and 23 deletions

View File

@ -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