Skip to content

Commit

Permalink
fix: Improve output naming
Browse files Browse the repository at this point in the history
  • Loading branch information
simenandre committed Feb 8, 2021
1 parent 4c40da0 commit b05e066
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ jobs:
key: something
map: |
'.*': This means the Regex works
- run: echo ${{ steps.test1.outputs.out }}
- run: echo ${{ steps.test1.outputs.result }}
- uses: ./
id: test2
with:
key: something
map: |
'_default': Default works!
- run: echo ${{ steps.test2.outputs.out }}
- run: echo ${{ steps.test2.outputs.result }}
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ inputs:
required: true
description: input description here
default: default value if applicable
var-name:
required: false
description: 'output variable name'
default: result
outputs:
out:
description: the mapped value
Expand Down
6 changes: 4 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as yaml from 'yaml';
export const config = rt.Record({
key: rt.String,
map: rt.Dictionary(rt.String),
varName: rt.String,
});

export type Config = rt.Static<typeof config>;
Expand All @@ -13,6 +14,7 @@ export async function makeConfig(): Promise<Config> {
const map = yaml.parse(getInput('map', { required: true }));
return config.check({
key: getInput('key', { required: true }),
varName: getInput('var-name') || 'result',
map,
});
}
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { matcher } from './matcher';
async function run(): Promise<void> {
try {
const config = await makeConfig();
const out = matcher(config.key, config.map);
core.setOutput('out', out);
const result = matcher(config.key, config.map);
core.setOutput('result', result);
} catch (error) {
core.setFailed(error.message);
}
Expand Down

0 comments on commit b05e066

Please sign in to comment.