Skip to content

Commit e16c77e

Browse files
committed
makefile
1 parent e8e7839 commit e16c77e

File tree

11 files changed

+37
-101
lines changed

11 files changed

+37
-101
lines changed

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright GitHub
3+
Copyright ReversingLabs 2025
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
all:
3+
npm run bundle
4+
5+
test:
6+
npm test

__tests__/main.test.ts

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
* functions and objects. For example, the core module is mocked in this test,
66
* so that the actual '@actions/core' module is not imported.
77
*/
8+
89
import { jest } from '@jest/globals'
910
import * as core from '../__fixtures__/core.js'
1011
import { wait } from '../__fixtures__/wait.js'
1112

1213
// Mocks should be declared before the module being tested is imported.
1314
jest.unstable_mockModule('@actions/core', () => core)
14-
jest.unstable_mockModule('../src/wait.js', () => ({ wait }))
1515

1616
// The module being tested should be imported dynamically. This ensures that the
1717
// mocks are used in place of any actual dependencies.
@@ -20,7 +20,7 @@ const { run } = await import('../src/main.js')
2020
describe('main.ts', () => {
2121
beforeEach(() => {
2222
// Set the action's inputs as return values from core.getInput().
23-
core.getInput.mockImplementation(() => '500')
23+
core.getInput.mockImplementation(() => 'report.rl.json')
2424

2525
// Mock the wait function so that it does not actually wait.
2626
wait.mockImplementation(() => Promise.resolve('done!'))
@@ -32,31 +32,5 @@ describe('main.ts', () => {
3232

3333
it('Sets the time output', async () => {
3434
await run()
35-
36-
// Verify the time output was set.
37-
expect(core.setOutput).toHaveBeenNthCalledWith(
38-
1,
39-
'time',
40-
// Simple regex to match a time string in the format HH:MM:SS.
41-
expect.stringMatching(/^\d{2}:\d{2}:\d{2}/)
42-
)
43-
})
44-
45-
it('Sets a failed status', async () => {
46-
// Clear the getInput mock and return an invalid value.
47-
core.getInput.mockClear().mockReturnValueOnce('this is not a number')
48-
49-
// Clear the wait mock and return a rejected promise.
50-
wait
51-
.mockClear()
52-
.mockRejectedValueOnce(new Error('milliseconds is not a number'))
53-
54-
await run()
55-
56-
// Verify that the action was marked as failed.
57-
expect(core.setFailed).toHaveBeenNthCalledWith(
58-
1,
59-
'milliseconds is not a number'
60-
)
6135
})
6236
})

__tests__/wait.test.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

action.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
1-
name: The name of your action here
2-
description: Provide a description here
3-
author: Your name or organization here
1+
name: rl-json-to-simple-feedback-markdown
2+
description:
3+
Parse the report.rl.json file and produce a markdown simplefied summary
4+
author: ReversingLabs
45

56
# Add your action's branding here. This will appear on the GitHub Marketplace.
67
branding:
78
icon: heart
8-
color: red
9+
color: purple
910

1011
# Define your inputs here.
1112
inputs:
12-
milliseconds:
13-
description: Your input description here
13+
rl_json_path:
14+
description: The path to the report.rl.json file.
1415
required: true
15-
default: '1000'
16-
17-
# Define your outputs here.
18-
outputs:
19-
time:
20-
description: Your output description here
2116

2217
runs:
2318
using: node20

dist/index.js

Lines changed: 9 additions & 11 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.

src/main.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,21 @@ import fs from 'fs'
1111
*/
1212
export async function run(): Promise<void> {
1313
try {
14-
// const ms: string = core.getInput('milliseconds')
15-
const rl_json_file: string = core.getInput('rl_json_file')
14+
const rl_json_file: string = core.getInput('rl_json_path')
1615
const data = JSON.parse(fs.readFileSync(rl_json_file, 'utf-8'))
1716
core.debug(`loaded json file ${rl_json_file}`)
1817
core.debug(new Date().toTimeString())
1918

2019
const name: string = data.info.file.identity.name
2120
const purl: string = data.info.file.identity.purl
22-
core.debug(`name: {name}, purl: {purl}`)
23-
24-
// data.info.file.identity {name, purl }
25-
// data.report.metadata.assessments
21+
core.debug(`name: ${name}, purl: ${purl}`)
2622

2723
// Set outputs for other workflow steps to use
28-
core.setOutput('time', new Date().toTimeString())
24+
// core.setOutput('time', new Date().toTimeString())
2925
} catch (error) {
3026
// Fail the workflow run if an error occurs
31-
if (error instanceof Error) core.setFailed(error.message)
27+
if (error instanceof Error) {
28+
core.setFailed(error.message)
29+
}
3230
}
3331
}

src/wait.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

tsconfig.eslint.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"extends": "./tsconfig.base.json",
44
"compilerOptions": {
55
"allowJs": true,
6-
"noEmit": true
6+
"noEmit": true,
7+
"isolatedModules": true
78
},
89
"exclude": ["dist", "node_modules"],
910
"include": [

0 commit comments

Comments
 (0)