-
Notifications
You must be signed in to change notification settings - Fork 11
75 lines (64 loc) · 2.47 KB
/
dependency-diff.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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 > dependency-diff.md
# output in json format for fetching release notes
composer-lock-diff --from=${{ github.event.pull_request.base.sha }} --json > composer-diff.json
- name: NPM Diff
if: contains(steps.changed-files.outputs.modified_files, 'web/themes/custom/contribtracker/package-lock.json')
run: |
npm install -g diff-lockfiles
echo '**NPM Package changes**' >> dependency-diff.md
echo '```' >> dependency-diff.md
diff-lockfiles ${{ github.event.pull_request.base.sha }} HEAD --shallow >> dependency-diff.md
echo '```' >> dependency-diff.md
- name: Fetch Release notes
uses: actions/github-script@v7
with:
script: |
const fetchReleaseNotes = require('${{ github.workspace }}/.github/workflows/release-notes/fetch-data.js')
const release_notes = await fetchReleaseNotes()
require('fs').appendFileSync('${{ github.workspace }}/dependency-diff.md', release_notes);
- name: Add PR comment
if: steps.changed-files.outputs.any_modified == 'true'
uses: mshick/add-pr-comment@v2
with:
message-id: dependency-diff
message-path: dependency-diff.md