Need help for Pokémon 3D Api for react/next support
Issue Overview I am working on a GitHub Action to automate the conversion of .glb 3D models into .jsx components using gltfjsx. The goal is to: Detect changes in models/glb/ directory Convert or update corresponding JSX files in models/gltfjsx/ Modify JSX files to use export default and update useGLTF paths Commit and push the changes directly to the main branch The CLI script works fine locally, but the GitHub Action is failing to push updates. Repo link: Pokémon3D GitHub Action Workflow name: Convert Updated GLB to JSX on: push: paths: - "models/glb/**/*.glb" # Runs only if a .glb file changes workflow_dispatch: # Allows manual trigger jobs: convert-glb: runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 20 - name: Install gltfjsx run: npm install -g gltfjsx - name: Find Modified GLB Files id: changed-files run: | FILES=$(git diff --name-only HEAD^ HEAD -- 'models/glb/**/*.glb' | xargs) echo "FILES=$FILES" >> $GITHUB_ENV - name: Convert or Update JSX Files if: env.FILES != '' run: | GITHUB_BASE_URL="https://raw.githubusercontent.com/Sudhanshu-Ambastha/Pokemon-3D/main" for glb_file in $FILES; do category=$(basename "$(dirname "$glb_file")") output_dir="models/gltfjsx/$category" mkdir -p "$output_dir" model_name=$(basename "$glb_file" .glb) output_file="$output_dir/$model_name.jsx" github_url="$GITHUB_BASE_URL/$glb_file" if [ -f "$output_file" ]; then if grep -q "useGLTF(\"$github_url\")" "$output_file"; then echo "✅ $output_file is already up to date." continue else echo "⚠️ Fixing path in: $output_file" fi else echo "

Issue Overview
I am working on a GitHub Action to automate the conversion of .glb
3D models into .jsx
components using gltfjsx. The goal is to:
Detect changes in models/glb/ directory
Convert or update corresponding JSX files in models/gltfjsx/
Modify JSX files to use export default and update useGLTF paths
Commit and push the changes directly to the main branch
The CLI script works fine locally, but the GitHub Action is failing to push updates.
Repo link: Pokémon3D
GitHub Action Workflow
name: Convert Updated GLB to JSX
on:
push:
paths:
- "models/glb/**/*.glb" # Runs only if a .glb file changes
workflow_dispatch: # Allows manual trigger
jobs:
convert-glb:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install gltfjsx
run: npm install -g gltfjsx
- name: Find Modified GLB Files
id: changed-files
run: |
FILES=$(git diff --name-only HEAD^ HEAD -- 'models/glb/**/*.glb' | xargs)
echo "FILES=$FILES" >> $GITHUB_ENV
- name: Convert or Update JSX Files
if: env.FILES != ''
run: |
GITHUB_BASE_URL="https://raw.githubusercontent.com/Sudhanshu-Ambastha/Pokemon-3D/main"
for glb_file in $FILES; do
category=$(basename "$(dirname "$glb_file")")
output_dir="models/gltfjsx/$category"
mkdir -p "$output_dir"
model_name=$(basename "$glb_file" .glb)
output_file="$output_dir/$model_name.jsx"
github_url="$GITHUB_BASE_URL/$glb_file"
if [ -f "$output_file" ]; then
if grep -q "useGLTF(\"$github_url\")" "$output_file"; then
echo "✅ $output_file is already up to date."
continue
else
echo "⚠️ Fixing path in: $output_file"
fi
else
echo "