Skip to content

Commit 16b37ea

Browse files
committed
fix: latest release
1 parent 04cb5ea commit 16b37ea

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

dist/index.js

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ async function run() {
1111
await runAction(token, staleDays, commitMessageLines)
1212
}
1313

14-
run()
14+
run().catch((err) => core.setFailed(err))

src/release.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ async function getLatestRelease(token) {
55
const octokit = github.getOctokit(token)
66
const { owner, repo } = github.context.repo
77

8-
return octokit.rest.repos.getLatestRelease({
8+
const { data } = await octokit.rest.repos.getLatestRelease({
99
owner,
1010
repo,
1111
})
12+
13+
return data
1214
}
1315

1416
async function getUnreleasedCommits(token, latestReleaseDate, staleDays) {

test/release.spec.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ jest.mock('@actions/github', () => ({
1919
test('Gets the latest release of the repository', async () => {
2020
getOctokit.mockReturnValue({
2121
rest: {
22-
repos: { getLatestRelease: async () => allReleases[0] },
22+
repos: {
23+
getLatestRelease: async () => ({
24+
data: allReleases[0],
25+
}),
26+
},
2327
},
2428
})
2529
const latestReleaseResponse = await getLatestRelease(token)

0 commit comments

Comments
 (0)