Skip to content

Commit 3eb6279

Browse files
committed
Re-add test package. Only show warning in summary if option is used. Update copy.
1 parent 7cf33ac commit 3eb6279

File tree

8 files changed

+60
-26
lines changed

8 files changed

+60
-26
lines changed

.github/workflows/dependency-review.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ jobs:
1313
uses: actions/checkout@v4
1414
- name: Dependency Review
1515
uses: ./
16+
with:
17+
deny-licenses: MIT

README.md

Lines changed: 19 additions & 19 deletions
Large diffs are not rendered by default.

__tests__/summary.test.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ test('prints headline as h1', () => {
109109
expect(text).toContain('<h1>Dependency Review</h1>')
110110
})
111111

112-
test('adds deprecation warning for deny-licenses option', () => {
112+
test('does not add deprecation warning for deny-licenses option if not set', () => {
113113
summary.addSummaryToSummary(
114114
emptyChanges,
115115
emptyInvalidLicenseChanges,
@@ -119,8 +119,25 @@ test('adds deprecation warning for deny-licenses option', () => {
119119
)
120120
const text = core.summary.stringify()
121121

122+
expect(text).not.toContain(
123+
'⚠️ <strong>Deprecation Warning</strong>: The <em>deny-licenses</em> option is deprecated and will be removed in the next major version release, use <em>allow-licenses</em> instead.'
124+
)
125+
})
126+
127+
test('adds deprecation warning for deny-licenses option if set', () => {
128+
const config = {...defaultConfig, deny_licenses: ['MIT']}
129+
130+
summary.addSummaryToSummary(
131+
emptyChanges,
132+
emptyInvalidLicenseChanges,
133+
emptyChanges,
134+
scorecard,
135+
config
136+
)
137+
const text = core.summary.stringify()
138+
122139
expect(text).toContain(
123-
'⚠️ <strong>Deprecation Warning</strong>: The <em>deny-licenses</em> option is deprecated and will be removed in a future version, use <em>allow-licenses</em> instead.'
140+
'⚠️ <strong>Deprecation Warning</strong>: The <em>deny-licenses</em> option is deprecated for possible removal in the next major release. See [Deprecate the deny-licenses option #938](https://github.com/actions/dependency-review-action/issues/938) for more information.'
124141
)
125142
})
126143

dist/index.js

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"ansi-styles": "^6.2.1",
3535
"got": "^14.4.7",
3636
"jest": "^29.7.0",
37+
"moment": "^2.30.1",
3738
"octokit": "^3.1.2",
3839
"spdx-expression-parse": "^3.0.1",
3940
"spdx-satisfies": "^6.0.0",

src/summary.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ export function addSummaryToSummary(
2222
scorecard: Scorecard,
2323
config: ConfigurationOptions
2424
): string {
25-
addDenyListsDeprecationWarningToSummary()
25+
if (config.deny_licenses && config.deny_licenses.length > 0) {
26+
addDenyListsDeprecationWarningToSummary()
27+
}
2628

2729
const out: string[] = []
2830

@@ -110,7 +112,7 @@ export function addSummaryToSummary(
110112

111113
function addDenyListsDeprecationWarningToSummary(): void {
112114
core.summary.addRaw(
113-
`${icons.warning} <strong>Deprecation Warning</strong>: The <em>deny-licenses</em> option is deprecated and will be removed in a future version, use <em>allow-licenses</em> instead.`,
115+
`${icons.warning} <strong>Deprecation Warning</strong>: The <em>deny-licenses</em> option is deprecated for possible removal in the next major release. See [Deprecate the deny-licenses option #938](https://github.com/actions/dependency-review-action/issues/938) for more information.`,
114116
true
115117
)
116118
}

0 commit comments

Comments
 (0)