Skip to content

104 write new gh action to retry samples (#105) #241

104 write new gh action to retry samples (#105)

104 write new gh action to retry samples (#105) #241

name: Output from KCL Samples
permissions:
contents: write
pull-requests: write
on:
pull_request:
paths:
- '**/*.kcl'
- '**/project.toml'
- .github/workflows/output-from-kcl-samples.yml
branches:
- main
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Get Zoo Outputs
env:
KITTYCAD_API_TOKEN: ${{ secrets.KITTYCAD_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
GH_PR: ${{ github.event.pull_request.number }}
run: |
python output_from_kcl.py
- name: check for changes
id: git-check
run: |
git add .
if git status | grep -q "Changes to be committed"
then
echo "modified=true" >> $GITHUB_OUTPUT
else
echo "modified=false" >> $GITHUB_OUTPUT
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 }}