name: sorting on: push: branches: [main] paths: - "_sprites/**" - "scripts/**" permissions: contents: write jobs: run-scripts: runs-on: ubuntu-latest steps: - name: checkout uses: actions/checkout@v4 - name: setup uses: actions/setup-node@v4 with: node-version: "20" - name: requirments run: npm ci - name: setup python uses: actions/setup-python@v5 with: python-version: "3.13" - name: install python deps run: | python -m pip install --upgrade pip pip install pillow - name: scripts working-directory: ./scripts run: | rm -rf ../_sprites/unready npx tsx write.ts npx tsx sort.ts npx tsx unready.ts - name: commit changes (exclude sorted) run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" git add -A . git reset _sprites/sorted git reset _sprites/sorted-merged git commit -m "actions commit" || exit 0 git push - name: upload uses: actions/upload-artifact@v4 with: name: sorted path: ./_sprites/sorted retention-days: 15 - name: upload-merged uses: actions/upload-artifact@v4 with: name: sorted path: ./_sprites/sorted-merged retention-days: 15 - name: remove temp sorted folder run: | rm -rf ./_sprites/sorted rm -rf ./_sprites/sorted-merged - name: Delete Old Artifacts uses: actions/github-script@v6 id: artifact with: script: | const res = await github.rest.actions.listArtifactsForRepo({ owner: context.repo.owner, repo: context.repo.repo, }) res.data.artifacts .forEach(({ id }) => { github.rest.actions.deleteArtifact({ owner: context.repo.owner, repo: context.repo.repo, artifact_id: id, }) })