Update .gitea/workflows/kibot.yml
This commit is contained in:
@@ -87,26 +87,26 @@ jobs:
|
||||
else
|
||||
# Create Python script to detect layers
|
||||
cat > /tmp/detect_layers.py << 'PYTHON_SCRIPT'
|
||||
#!/usr/bin/env python3
|
||||
import re
|
||||
import sys
|
||||
#!/usr/bin/env python3
|
||||
import re
|
||||
import sys
|
||||
|
||||
try:
|
||||
pcb_file = sys.argv[1]
|
||||
with open(pcb_file, 'r') as f:
|
||||
content = f.read()
|
||||
# Find all copper layers
|
||||
copper_layers = re.findall(r'\(layer\s+"([^"]+)".*?\(type\s+"?copper"?\)', content, re.DOTALL)
|
||||
# Count inner layers (In1.Cu, In2.Cu, etc)
|
||||
inner_layers = [l for l in copper_layers if 'In' in l and '.Cu' in l]
|
||||
total = 2 + len(inner_layers) # F.Cu + B.Cu + inner layers
|
||||
print(total)
|
||||
except Exception as e:
|
||||
print(2) # Default to 2 layers
|
||||
PYTHON_SCRIPT
|
||||
try:
|
||||
pcb_file = sys.argv[1]
|
||||
with open(pcb_file, 'r') as f:
|
||||
content = f.read()
|
||||
# Find all copper layers
|
||||
copper_layers = re.findall(r'\(layer\s+"([^"]+)".*?\(type\s+"?copper"?\)', content, re.DOTALL)
|
||||
# Count inner layers (In1.Cu, In2.Cu, etc)
|
||||
inner_layers = [l for l in copper_layers if 'In' in l and '.Cu' in l]
|
||||
total = 2 + len(inner_layers) # F.Cu + B.Cu + inner layers
|
||||
print(total)
|
||||
except Exception as e:
|
||||
print(2) # Default to 2 layers
|
||||
PYTHON_SCRIPT
|
||||
|
||||
chmod +x /tmp/detect_layers.py
|
||||
LAYERS=$(/tmp/detect_layers.py "$PCB_FILE")
|
||||
LAYERS=$(python3 /tmp/detect_layers.py "$PCB_FILE")
|
||||
echo "layers=$LAYERS" >> $GITHUB_OUTPUT
|
||||
echo "Auto-detected $LAYERS layer board"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user