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