Skip to content

Commit f17782d

Browse files
Merge pull request #16 from mongodb-js/MCP-231
ci: verify third-party licenses on PR and change to plaintext format from html third-party licenses
2 parents 26efe3a + f610619 commit f17782d

File tree

8 files changed

+2405
-860
lines changed

8 files changed

+2405
-860
lines changed

.github/workflows/CI.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ env:
66
CARGO_INCREMENTAL: '1'
77
CARGO_DENY_VERSION: 0.18.4
88
CARGO_AUDIT_VERSION: 0.21.2
9+
CARGO_ABOUT_VERSION: 0.8.2
910
'on':
1011
push:
1112
branches:
@@ -362,7 +363,7 @@ jobs:
362363
uses: actions/cache@v4
363364
with:
364365
path: ~/.cargo/bin
365-
key: ${{ runner.os }}-cargo-tools-deny-${{ env.CARGO_DENY_VERSION }}-audit-${{ env.CARGO_AUDIT_VERSION }}
366+
key: ${{ runner.os }}-cargo-tools-deny-${{ env.CARGO_DENY_VERSION }}-audit-${{ env.CARGO_AUDIT_VERSION }}-about-${{ env.CARGO_ABOUT_VERSION }}
366367
restore-keys: |
367368
${{ runner.os }}-cargo-tools-
368369
@@ -378,8 +379,27 @@ jobs:
378379
cargo install --locked --version ${{ env.CARGO_AUDIT_VERSION }} cargo-audit
379380
fi
380381
382+
- name: Install cargo-about
383+
run: |
384+
if ! command -v cargo-about &> /dev/null; then
385+
cargo install --locked --version ${{ env.CARGO_ABOUT_VERSION }} cargo-about
386+
fi
387+
381388
- name: Run cargo deny
382389
run: cargo deny check
383390

384391
- name: Run cargo audit
385392
run: cargo audit
393+
394+
- name: Verify LICENSE-3RD-PARTY.txt is up to date
395+
run: |
396+
cargo about generate --frozen about.hbs > LICENSE-3RD-PARTY-generated.txt
397+
if ! diff -q LICENSE-3RD-PARTY.txt LICENSE-3RD-PARTY-generated.txt > /dev/null; then
398+
echo "ERROR: LICENSE-3RD-PARTY.txt is not up to date!"
399+
echo "Please run: cargo about generate about.hbs > LICENSE-3RD-PARTY.txt"
400+
echo "Differences found:"
401+
diff LICENSE-3RD-PARTY.txt LICENSE-3RD-PARTY-generated.txt || true
402+
exit 1
403+
fi
404+
rm LICENSE-3RD-PARTY-generated.txt
405+
echo "LICENSE-3RD-PARTY.txt is up to date"

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ dist
117117
#Added by cargo
118118

119119
/target
120-
Cargo.lock
121120

122121
*.node
123122
.pnp.*

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ This verifies that all dependencies use acceptable licenses and checks for known
101101
We use [`cargo-about`](https://github.com/EmbarkStudios/cargo-about) to generate our third-party licenses notice:
102102

103103
```sh
104-
cargo about generate about.hbs > license.html
104+
cargo about generate --frozen about.hbs > LICENSE-3RD-PARTY.txt
105105
```
106106

107-
This generates an HTML file containing all third-party license information for our dependencies.
107+
This generates the file containing all third-party license information for our dependencies.
108108

109109
## Submitting Your Changes
110110

0 commit comments

Comments
 (0)