diff --git a/.github/workflows/update_toolchain.yml b/.github/workflows/update_toolchain.yml index 2f981671c..e9ea7a9a0 100644 --- a/.github/workflows/update_toolchain.yml +++ b/.github/workflows/update_toolchain.yml @@ -33,9 +33,26 @@ jobs: - name: Set new versions if: steps.changes.outputs.status > 0 + id: new-versions run: | proto use pnpm i + echo "version=$(pnpm -v)" >> $GITHUB_OUTPUT + + - name: Update package.json + if: steps.changes.outputs.status > 0 + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + const packageJson = fs.readFileSync('./package.json', 'utf8'); + const json = JSON.parse(packageJson); + const packageManager = json.packageManager; + const newVersion = `pnpm@${{ steps.new-versions.outputs.version }}`; + if (packageManager !== newVersion) { + json.packageManager = newVersion; + fs.writeFileSync('./package.json', JSON.stringify(json, null, 2)); + } - name: Health check if: steps.changes.outputs.status > 0 @@ -51,6 +68,7 @@ jobs: if: steps.changes.outputs.status > 0 && success() run: | git add .prototools + git add package.json git commit -m "🔧 (repo) [NO-ISSUE]: Update toolchain" git push origin ${{ env.BRANCH_NAME }} gh pr create \