Skip to content

Commit 89c2983

Browse files
authored
Merge pull request #5 from fabidick22/refactor-outputs
Rename and create new outputs
2 parents 07a7eca + 74bbeda commit 89c2983

File tree

3 files changed

+18
-24
lines changed

3 files changed

+18
-24
lines changed

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Action to get paths and files changed in a Pull Request event and use these for
77
- Get list of files changed in a PR
88

99
## Usage
10-
<details><summary><strong> Get a list of paths to use in a matrix of jobs</strong></summary>
10+
<details><summary><strong> Get a list of paths to use in a matrix of jobs (v1)</strong></summary>
1111

1212
```yaml
1313
name: 'PR Detect changes'
@@ -57,12 +57,10 @@ jobs:
5757

5858
| parameter | description |
5959
| - | - |
60-
| paths_changed | List of changed paths, example:
61-
``` ["dist", "dist/data"] ```
62-
|
63-
| file_changed | List of changed files, example:
64-
``` ["dist/main.tf", "dist/index.js"] ```
65-
|
60+
| paths_list | List of changed paths, example: `["dist", "dist/data"]` |
61+
| file_list | List of changed files, example: `["dist/main.tf", "dist/index.js"]` |
62+
| paths_str | List of changed paths separated by `,` example: `"dist,dist/data"` |
63+
| file_str | List of changed files separated by `,` example: `"dist/main.tf,dist/index.js"` |
6664

6765

6866

action.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,14 @@ inputs:
1313
required: false
1414
default: ${{ github.token }}
1515
outputs:
16-
paths_changed:
17-
description: >
18-
List of changed paths, example:
19-
20-
```
21-
["dist", "dist/data"]
22-
```
23-
file_changed:
24-
description: >
25-
List of changed files, example:
26-
27-
```
28-
["dist/main.tf", "dist/index.js"]
29-
```
16+
paths_list:
17+
description: 'List of changed paths, example: `["dist", "dist/data"]`'
18+
file_list:
19+
description: 'List of changed files, example: `["dist/main.tf", "dist/index.js"]`'
20+
paths_str:
21+
description: 'List of changed paths separated by `,` example: `"dist,dist/data"`'
22+
file_str:
23+
description: 'List of changed files separated by `,` example: `"dist/main.tf,dist/index.js"`'
3024
runs:
3125
using: 'node16'
3226
main: 'dist/index.js'

index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ async function setOutputs(files) {
88
pathsChanged.push(file.filename.split("/").slice(0, -1).join("/"))
99
filesChanged.push(file.filename)
1010
})
11-
core.setOutput("paths_changed", JSON.stringify([...new Set(pathsChanged)]))
12-
core.setOutput("file_changed", JSON.stringify(filesChanged))
11+
core.setOutput("paths_list", JSON.stringify([...new Set(pathsChanged)]))
12+
core.setOutput("file_list", JSON.stringify([...new Set(filesChanged)]))
13+
core.setOutput("paths_str", [...new Set(pathsChanged)].join())
14+
core.setOutput("file_str", [...new Set(filesChanged)].join())
1315
}
1416

1517
const main = async () => {
@@ -33,7 +35,7 @@ const main = async () => {
3335
})
3436

3537
if (filteredFiles.length === 0) {
36-
console.log("No matchs found.")
38+
console.log("No matches found.")
3739
console.log(`Raw input: ${path}`)
3840
console.log(`Regex: ${regExp.toString()}`)
3941
}

0 commit comments

Comments
 (0)