Skip to content

Commit

Permalink
Return whole pruned versions
Browse files Browse the repository at this point in the history
Instead of returning a list of pruned version IDs, return the entire version object.
This allows for easier consumption of the pruned versions when building summary for the job run.
  • Loading branch information
vlaurin committed Oct 23, 2022
1 parent 51c0937 commit 6835473
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const run = async () => {
}

core.setOutput('count', prunedList.length);
core.setOutput('prunedVersionIds', prunedList);
core.setOutput('prunedVersionIds', prunedList.map((version) => version.id));
core.setOutput('dryRun', dryRun);
} catch (error) {
core.setFailed(error.message);
Expand Down
2 changes: 1 addition & 1 deletion src/pruning.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const prune = (pruneVersion) => async (pruningList) => {
for (const version of pruningList) {
core.info(`Pruning version #${version.id} named '${version.name}'...`);
await pruneVersion(version);
pruned.push(version.id);
pruned.push(version);
}

core.endGroup();
Expand Down
4 changes: 2 additions & 2 deletions src/pruning.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('prune', () => {

const pruned = await prune(pruneVersion)(pruningList);

expect(pruned).toEqual([100001, 100000]);
expect(pruned).toEqual(pruningList);
expect(pruneVersion).toHaveBeenCalledTimes(2);
expect(pruneVersion).nthCalledWith(1, pruningList[0]);
expect(pruneVersion).nthCalledWith(2, pruningList[1]);
Expand Down Expand Up @@ -126,7 +126,7 @@ describe('prune', () => {

const pruned = await prune(pruneVersion)(pruningList);

expect(pruned).toEqual([100000]);
expect(pruned).toEqual([pruningList[0]]);
expect(pruneVersion).toHaveBeenCalledTimes(2);
expect(pruneVersion).nthCalledWith(1, pruningList[0]);
expect(pruneVersion).nthCalledWith(2, pruningList[1]);
Expand Down

0 comments on commit 6835473

Please sign in to comment.