Skip to content

Commit 177f64c

Browse files
RD-970 Refine scan result files in artifact (#2)
* RD-970 Delete staticResult from artifact & rename finalResult file name * RD-970 Update README.md and samples * RD-970 Add SVG usage to README.md --------- Co-authored-by: Clay Sang <[email protected]>
1 parent d58daff commit 177f64c

File tree

7 files changed

+26
-19
lines changed

7 files changed

+26
-19
lines changed

README.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,12 @@ jobs:
4747
4848
## Actions Artifact
4949
50-
After the scan is complete, an artifact named `DEEPBITS_SCAN_RESULTS` will be generated, which contains three files:
50+
After the scan is complete, an artifact named `DEEPBITS_SCAN_RESULTS` will be generated, which contains two files:
5151

52-
| Output | Description |
53-
| ------------------- | ------------------------------------------------------------------------------- |
54-
| sbom.CycloneDX.json | SBOM in CycloneDX format |
55-
| finalResult.json | The final scan report contains vulnerability and malware summary in JSON format |
56-
| staticResult.json | The static analysis report in JSON format |
52+
| Output | Description |
53+
| ------------------- | --------------------------------------------------------------------- |
54+
| sbom.CycloneDX.json | SBOM in CycloneDX format |
55+
| scanSummary.json | Scan result contains vulnerability and malware summary in JSON format |
5756

5857
**We have included a sample folder called `sample_scan_results` in the repository [here](./samples/DEEPBITS_SCAN_RESULTS/).**
5958

@@ -75,6 +74,20 @@ To obtain these outputs, please refer to the three options listed below:
7574
| DEEPBITS_COMMIT | The URL to access the scan report of the commit on DeepRepo |
7675
| DEEPBITS_BADGE | A SVG badge displaying the status of the the repo |
7776

77+
You can add the SVG badge to your README.md file like this:
78+
79+
```markdown
80+
[![SBOM status]({{DEEPBITS_BADGE}})]({{DEEPBITS_REPO}})
81+
```
82+
83+
For example, the badge for this repository is:
84+
85+
```markdown
86+
[![SBOM status](https://api.deepbits.com/gh/DeepBitsTechnology/getsbom/badge)](https://tools.deepbits.com/github/DeepBitsTechnology/getsbom)
87+
```
88+
89+
[![SBOM status](https://api.deepbits.com/gh/DeepBitsTechnology/getsbom/badge)](https://tools.deepbits.com/github/DeepBitsTechnology/getsbom)
90+
7891
**The image below is a screenshot of a scan result on [DeepRepo](https://tools.deepbits.com/github), which is accessible through the `DEEPBITS_COMMIT` output.**
7992

8093
![Scan result on DeepRepo](./samples/deeprepo_scan_screenshots.png)

__tests__/main.test.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ describe('Main', () => {
3131
scanResult: [
3232
{
3333
finalResult: {bom: 'bom'},
34-
staticResult: [{filePath: 'fp'}],
3534
scanEndAt: Date.now().toString(),
3635
},
3736
],
@@ -43,8 +42,7 @@ describe('Main', () => {
4342
// Set up the expected artifact upload parameters
4443
const expectedUploadParams = [
4544
{name: 'sbom.CycloneDX', jsonContent: 'bom'},
46-
{name: 'staticResult', jsonContent: [{filePath: 'fp'}]},
47-
{name: 'finalResult', jsonContent: {bom: 'bom'}},
45+
{name: 'scanSummary', jsonContent: {bom: 'bom'}},
4846
];
4947

5048
await run();
@@ -68,8 +66,7 @@ describe('Main', () => {
6866

6967
const expectedUploadParams = [
7068
{name: 'sbom.CycloneDX', jsonContent: {}},
71-
{name: 'staticResult', jsonContent: {}},
72-
{name: 'finalResult', jsonContent: {}},
69+
{name: 'scanSummary', jsonContent: {}},
7370
];
7471

7572
await run();

dist/index.js

Lines changed: 2 additions & 3 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.
File renamed without changes.

samples/DEEPBITS_SCAN_RESULTS/staticResult.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/main.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ export async function run(): Promise<void> {
1717

1818
const scanResult = await getScanResult();
1919

20-
const {finalResult, staticResult} = scanResult?.scanResult?.[0] ?? {};
20+
const {finalResult} = scanResult?.scanResult?.[0] ?? {};
2121

2222
await uploadArtifacts([
2323
{name: 'sbom.CycloneDX', jsonContent: finalResult?.bom || {}},
24-
{name: 'staticResult', jsonContent: staticResult || {}},
25-
{name: 'finalResult', jsonContent: finalResult || {}},
24+
{name: 'scanSummary', jsonContent: finalResult || {}},
2625
]);
2726

2827
await setInfo();

0 commit comments

Comments
 (0)