Build(deps): Bump pinia from 4.0.2 to 4.0.3 in /aas-web-ui #191
Workflow file for this run
This file contains hidden or 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: Sync pnpm packageManager version | |
| on: | |
| push: | |
| branches: | |
| - "dependabot/npm_and_yarn/**" | |
| paths: | |
| - "aas-web-ui/package.json" | |
| permissions: | |
| contents: write | |
| jobs: | |
| sync-pnpm-version: | |
| runs-on: ubuntu-latest | |
| # Only run when the push is made by Dependabot | |
| if: github.actor == 'dependabot[bot]' | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| # Use a token with write access to push back to the Dependabot branch. | |
| # The default GITHUB_TOKEN is sufficient for branches in the same repo. | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| ref: ${{ github.ref }} | |
| - name: Extract pnpm version from devDependencies | |
| id: pnpm-version | |
| run: | | |
| VERSION=$(node -e " | |
| const pkg = JSON.parse(require('fs').readFileSync('aas-web-ui/package.json', 'utf8')); | |
| const raw = pkg.devDependencies?.pnpm; | |
| if (!raw) { process.stderr.write('No pnpm devDependency found\n'); process.exit(1); } | |
| // Strip leading range specifier (^, ~, >=, etc.) | |
| const match = raw.match(/(\d+\.\d+\.\d+)/); | |
| if (!match) { process.stderr.write('Cannot parse pnpm version: ' + raw + '\n'); process.exit(1); } | |
| process.stdout.write(match[1]); | |
| ") | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "Detected pnpm version: $VERSION" | |
| - name: Fetch sha512 integrity for new pnpm version | |
| id: pnpm-integrity | |
| run: | | |
| VERSION="${{ steps.pnpm-version.outputs.version }}" | |
| INTEGRITY=$(npm view "pnpm@${VERSION}" dist.integrity 2>/dev/null) | |
| if [ -z "$INTEGRITY" ]; then | |
| echo "Could not fetch integrity for pnpm@${VERSION}" >&2 | |
| exit 1 | |
| fi | |
| # Corepack packageManager hashes use hex, while npm dist.integrity is SRI base64. | |
| HASH=$(INTEGRITY="$INTEGRITY" node -e ' | |
| const integrity = process.env.INTEGRITY ?? ""; | |
| const match = integrity.match(/^sha512-(.+)$/); | |
| if (!match) { | |
| process.stderr.write(`Unexpected integrity format: ${integrity}\n`); | |
| process.exit(1); | |
| } | |
| process.stdout.write(Buffer.from(match[1], "base64").toString("hex")); | |
| ') | |
| echo "hash=$HASH" >> "$GITHUB_OUTPUT" | |
| echo "sha512 hash: $HASH" | |
| - name: Update packageManager field in package.json | |
| run: | | |
| VERSION="${{ steps.pnpm-version.outputs.version }}" | |
| HASH="${{ steps.pnpm-integrity.outputs.hash }}" | |
| node -e " | |
| const fs = require('fs'); | |
| const path = 'aas-web-ui/package.json'; | |
| const pkg = JSON.parse(fs.readFileSync(path, 'utf8')); | |
| pkg.packageManager = 'pnpm@${VERSION}+sha512.${HASH}'; | |
| fs.writeFileSync(path, JSON.stringify(pkg, null, 2) + '\n'); | |
| " | |
| echo "Updated packageManager to pnpm@${VERSION}+sha512.${HASH}" | |
| - name: Commit packageManager change | |
| run: | | |
| TARGET="${{ steps.pnpm-version.outputs.version }}" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add aas-web-ui/package.json | |
| if git diff --staged --quiet; then | |
| echo "No pnpm sync changes to commit." | |
| else | |
| git commit -m "chore: sync packageManager to pnpm ${TARGET}" | |
| git push | |
| fi |