Skip to content

Commit

Permalink
Add file output
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrisbin committed Aug 26, 2024
1 parent 97746a8 commit 4966f5b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jobs:
os-win32: windows
arch: x86_64
- run: ls -l '${{ steps.setup-hlint.outputs.directory }}'
- if: ${{ matrix.runner != 'windows-latest' }} # it's .exe on win32
run: ls -l '${{ steps.setup-hlint.outputs.file }}'
- run: hlint --version

- id: setup-dms
Expand All @@ -56,6 +58,8 @@ jobs:
os-win32: windows
arch: amd64
- run: ls -l '${{ steps.setup-dms.outputs.directory }}'
- if: ${{ matrix.runner != 'windows-latest' }}
run: ls -l '${{ steps.setup-hlint.outputs.file }}'
- run: dms --version

- id: setup-pandoc
Expand All @@ -71,6 +75,8 @@ jobs:
arch: x86_64
arch-linux: amd64
- run: ls -l '${{ steps.setup-pandoc.outputs.directory }}'
- if: ${{ matrix.runner != 'windows-latest' }}
run: ls -l '${{ steps.setup-hlint.outputs.file }}'
- run: pandoc --version

- if: ${{ matrix.runner == 'ubuntu-latest' }}
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,10 @@ For more complex examples, see below or the project's test suite.

## Outputs

| name | description |
| ----------- | ------------------------------------------------------------------------- |
| `directory` | <p>Directory that was added to <code>$PATH</code> as result of setup.</p> |
| name | description |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `directory` | <p>Directory that was added to <code>$PATH</code> as result of setup.</p> |
| `file` | <p>This is always <code>outputs.directory/inputs.name</code>, which will <em>usually</em> match the path to the downloaded and extracted binary. Only use this output if you expect that to be the case.</p> |

<!-- action-docs-outputs action="action.yml" -->

Expand Down
3 changes: 3 additions & 0 deletions action-types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,6 @@ inputs:
outputs:
directory:
type: string

file:
type: string
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ outputs:
directory:
description: Directory that was added to `$PATH` as result of setup.

file:
description: |
This is always `outputs.directory/inputs.name`, which will _usually_ match
the path to the downloaded and extracted binary. Only use this output if
you expect that to be the case.
runs:
using: "node20"
main: "dist/index.js"
Expand Down
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ async function run() {
const dir = await findOrDownload(config);
core.addPath(dir);
core.setOutput("directory", dir);
core.setOutput("file", path.join(dir, config.tool.name));
core.info(
`${config.tool.name} ${config.tool.version} is now set up at ${dir}`,
);
Expand Down

0 comments on commit 4966f5b

Please sign in to comment.