Add "changes" output variable to support matrix job configuration

This commit is contained in:
Michal Dorner 2020-12-17 22:33:11 +01:00
parent 84e1697bff
commit 9e8c9af501
No known key found for this signature in database
GPG key ID: 9EEE04B48DA36786
5 changed files with 67 additions and 4 deletions

10
dist/index.js vendored
View file

@ -4791,10 +4791,12 @@ async function getChangedFilesFromApi(token, pullRequest) {
}
function exportResults(results, format) {
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}]`);
@ -4809,6 +4811,14 @@ function exportResults(results, format) {
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();
}
function serializeExport(files, format) {