diff --git a/README.md b/README.md index e79a674..2c91ccf 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Action to get paths and files changed in a Pull Request event and use these for - Get list of files changed in a PR ## Usage -
Get a list of paths to use in a matrix of jobs +
Get a list of paths to use in a matrix of jobs (v1) ```yaml name: 'PR Detect changes' @@ -57,12 +57,10 @@ jobs: | parameter | description | | - | - | -| paths_changed | List of changed paths, example: -``` ["dist", "dist/data"] ``` - | -| file_changed | List of changed files, example: -``` ["dist/main.tf", "dist/index.js"] ``` - | +| paths_list | List of changed paths, example: `["dist", "dist/data"]` | +| file_list | List of changed files, example: `["dist/main.tf", "dist/index.js"]` | +| paths_str | List of changed paths separated by `,` example: `"dist,dist/data"` | +| file_str | List of changed files separated by `,` example: `"dist/main.tf,dist/index.js"` | diff --git a/action.yml b/action.yml index 003d510..c0ed79d 100644 --- a/action.yml +++ b/action.yml @@ -13,20 +13,14 @@ inputs: required: false default: ${{ github.token }} outputs: - paths_changed: - description: > - List of changed paths, example: - - ``` - ["dist", "dist/data"] - ``` - file_changed: - description: > - List of changed files, example: - - ``` - ["dist/main.tf", "dist/index.js"] - ``` + paths_list: + description: 'List of changed paths, example: `["dist", "dist/data"]`' + file_list: + description: 'List of changed files, example: `["dist/main.tf", "dist/index.js"]`' + paths_str: + description: 'List of changed paths separated by `,` example: `"dist,dist/data"`' + file_str: + description: 'List of changed files separated by `,` example: `"dist/main.tf,dist/index.js"`' runs: using: 'node16' main: 'dist/index.js' diff --git a/index.js b/index.js index 651b3a2..5af2971 100644 --- a/index.js +++ b/index.js @@ -8,8 +8,10 @@ async function setOutputs(files) { pathsChanged.push(file.filename.split("/").slice(0, -1).join("/")) filesChanged.push(file.filename) }) - core.setOutput("paths_changed", JSON.stringify([...new Set(pathsChanged)])) - core.setOutput("file_changed", JSON.stringify(filesChanged)) + core.setOutput("paths_list", JSON.stringify([...new Set(pathsChanged)])) + core.setOutput("file_list", JSON.stringify([...new Set(filesChanged)])) + core.setOutput("paths_str", [...new Set(pathsChanged)].join()) + core.setOutput("file_str", [...new Set(filesChanged)].join()) } const main = async () => { @@ -33,7 +35,7 @@ const main = async () => { }) if (filteredFiles.length === 0) { - console.log("No matchs found.") + console.log("No matches found.") console.log(`Raw input: ${path}`) console.log(`Regex: ${regExp.toString()}`) }