mirror of
https://github.com/dorny/paths-filter.git
synced 2025-06-08 00:59:04 +00:00
Add "changes" output variable to support matrix job configuration
This commit is contained in:
parent
84e1697bff
commit
9e8c9af501
5 changed files with 67 additions and 4 deletions
10
src/main.ts
10
src/main.ts
|
@ -175,10 +175,12 @@ async function getChangedFilesFromApi(
|
|||
|
||||
function exportResults(results: FilterResults, format: ExportFormat): void {
|
||||
core.info('Results:')
|
||||
const changes = []
|
||||
for (const [key, files] of Object.entries(results)) {
|
||||
const value = files.length > 0
|
||||
core.startGroup(`Filter ${key} = ${value}`)
|
||||
if (files.length > 0) {
|
||||
changes.push(key)
|
||||
core.info('Matching files:')
|
||||
for (const file of files) {
|
||||
core.info(`${file.filename} [${file.status}]`)
|
||||
|
@ -193,6 +195,14 @@ function exportResults(results: FilterResults, format: ExportFormat): void {
|
|||
core.setOutput(`${key}_files`, filesValue)
|
||||
}
|
||||
}
|
||||
|
||||
if (results['changes'] === undefined) {
|
||||
const changesJson = JSON.stringify(changes)
|
||||
core.info(`Changes output set to ${changesJson}`)
|
||||
core.setOutput('changes', changesJson)
|
||||
} else {
|
||||
core.info('Cannot set changes output variable - name already used by filter output')
|
||||
}
|
||||
core.endGroup()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue