Fixed pnpm-lock after renovate update #625
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: Fix pnpm-lock after renovate | |
| on: | |
| push: | |
| branches: | |
| - 'renovate/*' | |
| paths: | |
| - 'pnpm-lock.yaml' | |
| # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token | |
| permissions: {} | |
| jobs: | |
| fix-lock: | |
| permissions: | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| token: ${{ secrets.WORKFLOW_TOKEN }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 | |
| - name: Use Node.js | |
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | |
| with: | |
| node-version-file: .nvmrc | |
| - name: Fix | |
| run: | | |
| pnpm i --no-frozen-lockfile | |
| - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 | |
| with: | |
| add: 'pnpm-lock.yaml' | |
| commit: --signoff | |
| default_author: github_actions | |
| message: Fixed pnpm-lock after renovate update | |
| - name: Comment | |
| run: | | |
| read -a array <<< "$COMMIT_MESSAGE" | |
| if [ "${array[2]}" = "dependency" ]; then | |
| node bin/cdxgen.js --exclude test/\*\* -t js --deep | |
| echo "Output of \`pnpm why ${array[3]}\`:" > _tree.txt | |
| echo "\`\`\`" >> _tree.txt | |
| pnpm why ${array[3]} >> _tree.txt | |
| echo "\`\`\`" >> _tree.txt | |
| echo "Output of \`jq\` on components:" >> _tree.txt | |
| echo "\`\`\`" >> _tree.txt | |
| jq --arg dep "${array[3]}" '.components[] | select(."bom-ref" | test($dep))' bom.json >> _tree.txt | |
| echo "\`\`\`" >> _tree.txt | |
| echo "Output of \`jq\` on dependencies:" >> _tree.txt | |
| echo "\`\`\`" >> _tree.txt | |
| jq --arg dep "${array[3]}" '.dependencies[] | select(.ref | test($dep))' bom.json >> _tree.txt | |
| jq --arg dep "${array[3]}" '.dependencies[] | select(.dependsOn | any(test($dep)))' bom.json >> _tree.txt | |
| echo "\`\`\`" >> _tree.txt | |
| fi | |
| env: | |
| COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | |
| FETCH_LICENSE: true | |
| - uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2.8.2 | |
| if: hashFiles('_tree.txt') | |
| with: | |
| message-path: _tree.txt |