AXP-158: Dependency diff #4
This file contains 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: Dependency Diff | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
permissions: | |
pull-requests: write | |
contents: read | |
jobs: | |
dependency-diff: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout PR | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v44 | |
with: | |
files: | | |
composer.lock | |
web/themes/custom/contribtracker/package-lock.json | |
- name: List all changed files | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
for file in ${ALL_CHANGED_FILES}; do | |
echo "$file was changed" | |
done | |
- name: Set up PHP | |
if: contains(steps.changed-files.outputs.modified_files, 'composer.lock') | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.3' | |
- name: Install composer-lock-diff and run | |
if: contains(steps.changed-files.outputs.modified_files, 'composer.lock') | |
run: | | |
composer global require davidrjonas/composer-lock-diff:^1.0 | |
composer-lock-diff --from=${{ github.event.pull_request.base.sha }} --md > composer-diff.md | |
- name: Add PR comment | |
if: contains(steps.changed-files.outputs.modified_files, 'composer.lock') | |
uses: mshick/add-pr-comment@v2 | |
with: | |
message-id: dependency-diff | |
message-path: composer-diff.md | |
- name: NPM Diff | |
if: contains(steps.changed-files.outputs.modified_files, 'web/themes/custom/contribtracker/package-lock.json') | |
run: | | |
npm install -g diff-lockfiles | |
diff-lockfiles --color ${{ github.event.pull_request.base.sha }} HEAD --shallow |