-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
42 lines (38 loc) · 1.4 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Convert 3D files directory with KittyCAD
description: Convert all 3D files in a given directory to your desired output
branding:
icon: box
color: gray-dark
inputs:
kittycad-token:
required: true
description: 'KittyCAD API TOKEN, generated at https://kittycad.io/account'
input-directory:
required: true
description: 'folder containing files to be converted, allowed files are dae, fbx, obj, step and stl'
output-directory:
required: true
description: 'folder where converted files will be put'
conversion-type:
required: true
description: 'options are dae, fbx, fbxb, obj, step and stl'
runs:
using: 'composite'
steps:
- uses: KittyCAD/[email protected]
- name: convert files
id: convert-files
run: |
mkdir -p "${{ inputs.output-directory }}"
FILES_TO_CONVERT=$(find ${{ inputs.input-directory }} -type f \( -name "*.dae" -o -name "*.fbx" -o -name "*.obj" -o -name "*.step" -o -name "*.stl" \))
echo "converting:\n$FILES_TO_CONVERT\n"
for FILE in ${FILES_TO_CONVERT[@]}
do
BASENAME=$(basename $FILE)
RESULT=$(kittycad file convert $FILE "${{ inputs.output-directory }}/${BASENAME%.*}.${{ inputs.conversion-type }}")
echo "$RESULT\n"
done
echo "Done converting files!"
shell: bash
env:
KITTYCAD_TOKEN: ${{ inputs.kittycad-token }}