Skip to content

Fixed pnpm-lock after renovate update #203

Fixed pnpm-lock after renovate update

Fixed pnpm-lock after renovate update #203

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@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
- name: Fix & comment
run: |
read -a array <<< "$COMMIT_MESSAGE"
if [ "${array[2]}" = "pnpm" ]; then
pnpm i --no-frozen-lockfile
elif [ "${array[2]}" = "dependency" ]; then
pnpm i --no-frozen-lockfile
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
- 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