Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit 57d0d90

Browse files
authored
Small tweaks to NOTICE.MD generator (#1310)
1. When `collect-go-dependencies.sh` failed, the "Generate NOTICE.MD" GitHub Actions step didn't fail, because `pipefail` mode wasn't turned on. `shell: bash` fixes that and the step will now correctly fail in such case. 2. `collect-go-dependencies.sh` and `collect-manual-notices.sh` now look for go.mod and NOTICE.MD files recursively (`**` by default doesn't). This catches more things that should be included in `NOTICE.MD`.
1 parent 011c13b commit 57d0d90

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

.github/notice-generator/collect-go-dependencies.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -e
22

3-
for gomod in **/go.mod ; do
3+
find . -type f -name go.mod | while read -r gomod; do
44
pushd "$(dirname "$gomod")" 1>&2
55
echo "Processing $gomod" 1>&2
66

.github/notice-generator/collect-manual-notices.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
# (for example if we use code from a project, but that project isn't
55
# a Go dependency of our project)
66

7-
for notice in **/NOTICE.MD ; do
8-
if [ -f "$notice" ]; then
9-
echo "" # newline between added notices
10-
cat "$notice"
11-
fi
7+
find */ -type f -iname NOTICE.MD | while read -r notice; do
8+
echo "$notice" 1>&2
9+
10+
echo "" # newline between added notices
11+
cat "$notice"
1212
done
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{"name": "github.com/pascaldekloe/goe", "licenceType": "Public Domain"}
22
{"name": "github.com/pascaldekloe/name", "licenceType": "Public Domain"}
3-
{"name": "github.com/mrjones/oauth", "licenceFile": "MIT-LICENSE.txt"}
3+
{"name": "github.com/mrjones/oauth", "licenceFile": "MIT-LICENSE.txt"}
4+
{"name": "github.com/xeipuuv/gojsonpointer", "licenceFile": "LICENSE-APACHE-2.0.txt"}
5+
{"name": "github.com/xeipuuv/gojsonreference", "licenceFile": "LICENSE-APACHE-2.0.txt"}
6+
{"name": "github.com/xeipuuv/gojsonschema", "licenceFile": "LICENSE-APACHE-2.0.txt"}

.github/workflows/generate-notice.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
run: go install go.elastic.co/[email protected]
3232

3333
- name: Generate NOTICE.MD
34+
shell: bash # to get 'set -o pipefail'
3435
run: |
3536
rm NOTICE.MD
3637
.github/notice-generator/collect-go-dependencies.sh | sort | uniq | go-licence-detector -includeIndirect -noticeTemplate=.github/notice-generator/go-licence-detector/NOTICE.MD.tmpl -noticeOut=NOTICE.MD -overrides=.github/notice-generator/go-licence-detector/overrides.ndjson -rules=.github/notice-generator/go-licence-detector/rules.json
@@ -41,6 +42,7 @@ jobs:
4142

4243
- name: Check if NOTICE.MD changed
4344
id: notice-file-changed
45+
shell: bash # to get 'set -o pipefail'
4446
run: |
4547
git fetch origin
4648
if git ls-tree --name-only origin/main | grep -q '^NOTICE.MD$'; then

0 commit comments

Comments
 (0)