Skip to content

Commit 7a26091

Browse files
committed
Add path-with-slashes output
1 parent c7f788a commit 7a26091

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

__tests__/main.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ const tmpDir = fs.mkdtempSync(
2626
// Mock the GitHub Actions core library
2727
let errorMock: jest.SpiedFunction<typeof core.error>
2828
let getInputMock: jest.SpiedFunction<typeof core.getInput>
29+
let setOutputMock: jest.SpiedFunction<typeof core.setOutput>
2930

3031
describe('action', () => {
3132
beforeEach(() => {
3233
jest.clearAllMocks()
3334

3435
errorMock = jest.spyOn(core, 'error').mockImplementation()
3536
getInputMock = jest.spyOn(core, 'getInput').mockImplementation()
37+
setOutputMock = jest.spyOn(core, 'setOutput').mockImplementation()
3638
})
3739

3840
it('downloads 14.0.0', async () => {
@@ -51,5 +53,14 @@ describe('action', () => {
5153
await main.run()
5254
expect(runMock).toHaveReturned()
5355
expect(errorMock).not.toHaveBeenCalled()
56+
57+
expect(setOutputMock).toHaveBeenCalledWith(
58+
'path',
59+
expect.stringContaining(tmpDir)
60+
)
61+
expect(setOutputMock).toHaveBeenCalledWith(
62+
'path-with-slashes',
63+
expect.not.stringContaining('\\')
64+
)
5465
})
5566
})

badges/coverage.svg

Lines changed: 1 addition & 1 deletion
Loading

dist/index.js

Lines changed: 1 addition & 0 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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ export async function run(): Promise<void> {
109109

110110
// Set outputs for other workflow steps to use
111111
core.setOutput('path', destination)
112+
core.setOutput(
113+
'path-with-slashes',
114+
path.resolve(destination).split(path.sep).join('/')
115+
)
112116
} catch (error) {
113117
console.log('Error:', error)
114118
// Fail the workflow run if an error occurs

0 commit comments

Comments
 (0)