Skip to content

Commit 45e5acd

Browse files
Merge pull request #55 from RoboticsBrno/dpad-fix
Fixed left bottom hole position to be correctly aligned
2 parents a84a255 + de1e6e5 commit 45e5acd

File tree

3 files changed

+450
-276
lines changed

3 files changed

+450
-276
lines changed

.github/workflows/drc-3d-render.yml

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,35 +27,55 @@ jobs:
2727
steps:
2828
- name: Checkout
2929
uses: actions/checkout@v4
30-
31-
- name: Get changed files
32-
uses: dorny/paths-filter@v2
33-
id: changes
3430
with:
35-
filters: |
36-
pmod_projects:
37-
- 'pmod/**'
38-
- '!pmod/assets/**'
39-
- '!pmod/template/**'
40-
31+
fetch-depth: 0 # Fetch all history for proper diffing
32+
4133
- name: Find changed KiCad projects
4234
id: filter-projects
43-
if: steps.changes.outputs.pmod_projects == 'true'
4435
run: |
4536
echo "Checking for changed files in pmod directory..."
4637
4738
# Get the list of changed files
4839
if [ "${{ github.event_name }}" == "push" ]; then
4940
# For push events, compare with previous commit
50-
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD -- "pmod/")
51-
else
41+
if [ -n "${{ github.event.before }}" ]; then
42+
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} -- "pmod/")
43+
else
44+
# For initial push or force push, get all files
45+
CHANGED_FILES=$(git log -1 --name-only --oneline ${{ github.sha }} -- "pmod/")
46+
fi
47+
elif [ "${{ github.event_name }}" == "pull_request" ]; then
5248
# For PR events, compare with base branch
5349
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} -- "pmod/")
50+
else
51+
# For workflow_dispatch or other events, process all projects
52+
echo "Manual trigger - processing all projects"
53+
PROJECTS=$(find pmod -name "*.kicad_pro" -path "*/KiCad/*" | sed 's|/KiCad/.*\.kicad_pro||' | sort -u)
54+
if [ -n "${{ github.event.inputs.project_filter }}" ]; then
55+
echo "Filtering for project: ${{ github.event.inputs.project_filter }}"
56+
PROJECTS=$(echo "$PROJECTS" | grep "${{ github.event.inputs.project_filter }}" || true)
57+
fi
58+
if [ -n "$PROJECTS" ]; then
59+
# Convert to proper JSON array
60+
JSON_PROJECTS=$(echo "$PROJECTS" | jq -R -s -c 'split("\n") | map(select(. != ""))')
61+
echo "projects=$JSON_PROJECTS" >> $GITHUB_OUTPUT
62+
echo "Manual projects: $JSON_PROJECTS"
63+
else
64+
echo 'projects=[]' >> $GITHUB_OUTPUT
65+
fi
66+
exit 0
5467
fi
5568
5669
echo "Changed files:"
5770
echo "$CHANGED_FILES"
5871
72+
# If no changed files found, exit early
73+
if [ -z "$CHANGED_FILES" ]; then
74+
echo "No changed files found in pmod directory"
75+
echo 'projects=[]' >> $GITHUB_OUTPUT
76+
exit 0
77+
fi
78+
5979
# Extract unique project directories from changed files
6080
CHANGED_PROJECTS=()
6181
while IFS= read -r file; do
@@ -71,9 +91,17 @@ jobs:
7191
# Remove duplicates and convert to JSON
7292
if [ ${#CHANGED_PROJECTS[@]} -gt 0 ]; then
7393
UNIQUE_PROJECTS=($(printf "%s\n" "${CHANGED_PROJECTS[@]}" | sort -u))
74-
JSON_PROJECTS=$(printf '%s\n' "${UNIQUE_PROJECTS[@]}" | jq -R -s -c 'split("\n") | map(select(. != ""))')
75-
echo "Changed projects: $JSON_PROJECTS"
76-
echo "projects=$JSON_PROJECTS" >> $GITHUB_OUTPUT
94+
# Create proper JSON array
95+
JSON_ARRAY="["
96+
for i in "${!UNIQUE_PROJECTS[@]}"; do
97+
if [ $i -gt 0 ]; then
98+
JSON_ARRAY+=","
99+
fi
100+
JSON_ARRAY+="\"${UNIQUE_PROJECTS[$i]}\""
101+
done
102+
JSON_ARRAY+="]"
103+
echo "Changed projects: $JSON_ARRAY"
104+
echo "projects=$JSON_ARRAY" >> $GITHUB_OUTPUT
77105
else
78106
echo "No changed projects found"
79107
echo 'projects=[]' >> $GITHUB_OUTPUT
@@ -86,7 +114,7 @@ jobs:
86114
strategy:
87115
matrix:
88116
project: ${{ fromJson(needs.find-changed-projects.outputs.projects) }}
89-
name: KiCad DRC and 3D Export - ${{ fromJson(matrix.project) }}
117+
name: KiCad DRC and 3D Export - ${{ matrix.project }}
90118
steps:
91119
- name: Checkout
92120
uses: actions/checkout@v4

0 commit comments

Comments
 (0)