Skip to content

Commit 85086f2

Browse files
authored
Add summary (#530)
* Add summary * v0.0.3
1 parent e71833d commit 85086f2

3 files changed

Lines changed: 30 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# @caff/changed-packages-github-action
22

3+
## 0.0.3
4+
5+
- Add Github summary
6+
37
## 0.0.2
48

59
- Upgrade dependencies

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@caff/changed-packages-github-action",
3-
"version": "0.0.2-alpha.2",
3+
"version": "0.0.3",
44
"description": "A Github action to get the packages affected by your changesets",
55
"main": "lib/index.js",
66
"repository": "https://github.com/caffco/changed-packages-github-action",

src/github.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {getInput, setOutput, info, warning} from '@actions/core'
1+
import {getInput, setOutput, info, warning, summary} from '@actions/core'
22

33
export function getOptionsFromGithubActionInput(): {
44
repositoryRootPath: string
@@ -62,4 +62,28 @@ export function setGithubActionOutputFromResults({
6262
'packages_versions_after_applying_release_plan',
6363
packagesVersionsAfterApplyingReleasePlan
6464
)
65+
66+
const allPackages = new Set([
67+
...packagesAffectedByReleasePlan,
68+
...changedPackages
69+
])
70+
summary.addHeading('Changed packages').addTable([
71+
[
72+
{
73+
data: 'Package',
74+
header: true
75+
},
76+
{
77+
data: 'New version',
78+
header: true
79+
}
80+
],
81+
...Array.from(allPackages)
82+
.sort((lhs, rhs) => (lhs < rhs ? -1 : lhs > rhs ? 1 : 0))
83+
.map(packageName => [
84+
packageName,
85+
packagesVersionsAfterApplyingReleasePlan[packageName] ||
86+
'❌ (No changeset)'
87+
])
88+
])
6589
}

0 commit comments

Comments
 (0)