Skip to content

Commit 5d2c8fc

Browse files
committed
Show diff of dependencies in GitHub Actions
dependabot adds a link showing the diff of the dependency but when there are changes in indirect dependencies, these have to be diffed manually. This commit vendors the dependencies before and after a PR and outputs the diff.
1 parent 305800f commit 5d2c8fc

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.github/workflows/go.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,31 @@ jobs:
7878
gitdiff="$(git diff -U0)"
7979
echo "$gitdiff"
8080
test -z "$gitdiff"
81+
82+
vendor-diff:
83+
if: github.event_name == 'pull_request'
84+
runs-on: ubuntu-latest
85+
steps:
86+
- uses: actions/setup-go@v3
87+
with:
88+
go-version: ^1.18
89+
90+
- name: Checkout base commit
91+
uses: actions/checkout@v3
92+
with:
93+
path: a
94+
ref: ${{ github.base_ref }}
95+
- name: Download dependencies of base commit
96+
run: go mod vendor
97+
working-directory: a
98+
99+
- name: Checkout PR
100+
uses: actions/checkout@v3
101+
with:
102+
path: b
103+
- name: Download dependencies of PR
104+
run: go mod vendor
105+
working-directory: b
106+
107+
- name: Diff of dependencies
108+
run: diff -ur --color=always a/vendor b/vendor || true

0 commit comments

Comments
 (0)