diff --git a/README.md b/README.md index f25f4c2c..8b065162 100644 --- a/README.md +++ b/README.md @@ -20,3 +20,10 @@ jobs: with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ``` + +## Known limitations + +These are some known limitations of this action. I'd like to try to address them in the future. + +- Non-linear releases aren't supported. For example, releasing a patch to a prior major release after a new major release has been bumped. +- The first release for a project will be ignored. This is intentional, as the use case is unlikely. Most projects will either have several alphas that don't need release comments, or won't use issues/PRs for the first commit. diff --git a/dst/index.js b/dst/index.js index 448b843d..d70e5614 100644 --- a/dst/index.js +++ b/dst/index.js @@ -93,6 +93,14 @@ var closesMatcher = /aria-label="This commit closes issue #(\d+)\."/g; return [4 /*yield*/, octokit_1.repos.listReleases(__assign(__assign({}, github.context.repo), { per_page: 2 }))]; case 1: releases = (_c.sent()).data; + if (releases.length < 2) { + if (!releases.length) { + core.error("no releases found"); + return [2 /*return*/]; + } + core.info("first release"); + return [2 /*return*/]; + } _a = __read(releases, 2), currentRelease = _a[0], priorRelease = _a[1]; return [4 /*yield*/, octokit_1.repos.compareCommits(__assign(__assign({}, github.context.repo), { base: priorRelease.tag_name, head: currentRelease.tag_name }))]; case 2: diff --git a/src/index.ts b/src/index.ts index fbacddcd..2e69081d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,6 +18,16 @@ const closesMatcher = /aria-label="This commit closes issue #(\d+)\."/g; per_page: 2, }); + if (releases.length < 2) { + if (!releases.length) { + core.error("no releases found"); + return; + } + + core.info("first release"); + return; + } + const [currentRelease, priorRelease] = releases; const {