Skip to content

Commit

Permalink
refactor: refactor safe output naming and usage across files
Browse files Browse the repository at this point in the history
- Rename `escape-paths` to `safe-output` in the `test.yml`, `action.yml`, `main.test.ts`, and `main.ts` files.
- Remove `safe_output` input option from `action.yml`.
  • Loading branch information
jackton1 committed May 4, 2024
1 parent 6d499fb commit e7a8ebc
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,17 @@ jobs:
- name: Run glob for source-files.txt escape paths
uses: ./
id: glob-source-files-escape-paths
id: glob-source-files-safe-output
with:
files-from-source-file: |
src/__tests__/source-files.txt
src/__tests__/source-files.txt
escape-paths: true
safe-output: true

- name: Show output
run: |
echo "${{ steps.glob-source-files-escape-paths.outputs.paths }}"
cat "${{ steps.glob-source-files-escape-paths.outputs.paths-output-file }}"
echo "${{ steps.glob-source-files-safe-output.outputs.paths }}"
cat "${{ steps.glob-source-files-safe-output.outputs.paths-output-file }}"
- name: Run glob for source-files.txt
uses: ./
Expand Down
6 changes: 1 addition & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ inputs:
description: 'Separator used for the paths output.'
required: true
default: " "
escape-paths:
safe-output:
description: 'Escape special characters of filenames used in the `paths` output'
required: false
default: "true"
Expand Down Expand Up @@ -87,10 +87,6 @@ inputs:
diff:
description: 'Specify a diff string `..` or `...` used for comparing changes, when `include-deleted-files` is set to `true`'
required: false
safe_output:
description: 'Escaped filename returned in the output'
required: true
default: "true"

outputs:
paths:
Expand Down
4 changes: 2 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: 1 addition & 1 deletion src/__tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const defaultEnv = {
'INPUT_FOLLOW-SYMBOLIC-LINKS': 'true',
'INPUT_MATCH-DIRECTORIES': 'true',
'INPUT_MATCH-GITIGNORE-FILES': 'true',
'INPUT_ESCAPE-PATHS': 'false',
'INPUT_SAFE-OUTPUT': 'false',
'INPUT_HEAD-REPO-FORK': 'false',
INPUT_SEPARATOR: ' ',
'INPUT_STRIP-TOP-LEVEL-DIR': 'true',
Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export async function run(): Promise<void> {
trimWhitespace: false
})
const diff = core.getInput('diff', {required: false})
const escapePaths = core.getBooleanInput('escape-paths', {required: false})
const safeOutput = core.getBooleanInput('safe-output', {required: false})
const stripTopLevelDir = core.getBooleanInput('strip-top-level-dir', {
required: true
})
Expand Down Expand Up @@ -270,7 +270,7 @@ export async function run(): Promise<void> {
)
}

if (escapePaths) {
if (safeOutput) {
paths = new Set([...paths].map(p => escapeString(p)))
}

Expand Down

0 comments on commit e7a8ebc

Please sign in to comment.