Test action #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Output from KCL Samples | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: KittyCAD/action-install-cli@v0.2.12 | |
- name: Get KCL Outputs | |
env: | |
KITTYCAD_TOKEN: ${{ secrets.KITTYCAD_TOKEN }} | |
run: | | |
sed -i '/---/q' README.md | |
for file in *.kcl; do | |
echo "Processing $file..." | |
fileName="${file%.*}" | |
kittycad kcl snapshot $file ./screenshots-of-samples/$fileName.png | |
kittycad kcl export --output-format=step --src-unit=mm $file ./STEP-output-of-samples | |
mv ./STEP-output-of-samples/output.step ./STEP-output-of-samples/$fileName.step | |
echo "#### [$fileName](STEP-output-of-samples/$fileName.step)" >> README.md | |
echo "![$fileName](screenshots-of-samples/$fileName.png)" >> README.md | |
done | |
- name: check for changes | |
id: git-check | |
run: | | |
git add . | |
if git status | grep -q "Changes to be committed" | |
then | |
echo "::set-output name=modified::true" | |
else | |
echo "::set-output name=modified::false" | |
fi | |
- name: Commit changes, if any | |
if: steps.git-check.outputs.modified == 'true' | |
run: | | |
git add . | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
git fetch origin | |
echo ${{ github.head_ref }} | |
git checkout ${{ github.head_ref }} | |
git commit -am "In the realm of scripts and screens, adding a dash of mechanical dreams." || true | |
git push | |
git push origin ${{ github.head_ref }} |