Skip to content

Commit

Permalink
fix: do not require a initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
boywithkeyboard committed Jul 16, 2023
1 parent ad02056 commit 6cfb83c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
7 changes: 2 additions & 5 deletions action.js
Original file line number Diff line number Diff line change
Expand Up @@ -10309,9 +10309,6 @@ async function action() {
console.info(
`Latest release: ${latestRelease?.tag_name} (published at ${latestRelease?.created_at})`
);
if (!latestRelease) {
throw new Error("Failed to fetch latest release.");
}
let { data } = await rest.pulls.list({
...import_github.context.repo,
per_page: 100,
Expand Down Expand Up @@ -10347,7 +10344,7 @@ async function action() {
if (merged_at === null || user?.type === "Bot" || merge_commit_sha === null || status !== 200) {
continue;
}
if (new Date(latestRelease.created_at).getTime() >= new Date(merged_at).getTime()) {
if (latestRelease && new Date(latestRelease.created_at).getTime() >= new Date(merged_at).getTime()) {
continue;
}
const c = await rest.repos.getCommit({
Expand All @@ -10357,7 +10354,7 @@ async function action() {
if (c.status !== 200) {
continue;
}
if (c.data.commit.committer?.date && new Date(c.data.commit.committer?.date).getTime() <= new Date(latestRelease.created_at).getTime()) {
if (latestRelease && c.data.commit.committer?.date && new Date(c.data.commit.committer?.date).getTime() <= new Date(latestRelease.created_at).getTime()) {
continue;
}
const linkifyReferences = (commit) => {
Expand Down
8 changes: 2 additions & 6 deletions action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,6 @@ async function action() {
`Latest release: ${latestRelease?.tag_name} (published at ${latestRelease?.created_at})`,
)

if (!latestRelease) {
throw new Error('Failed to fetch latest release.')
}

let { data } = await rest.pulls.list({
...context.repo,
per_page: 100,
Expand Down Expand Up @@ -167,7 +163,7 @@ async function action() {
}

if (
new Date(latestRelease.created_at).getTime() >=
latestRelease && new Date(latestRelease.created_at).getTime() >=
new Date(merged_at).getTime()
) {
continue
Expand All @@ -183,7 +179,7 @@ async function action() {
}

if (
c.data.commit.committer?.date &&
latestRelease && c.data.commit.committer?.date &&
new Date(c.data.commit.committer?.date).getTime() <=
new Date(latestRelease.created_at).getTime()
) {
Expand Down

0 comments on commit 6cfb83c

Please sign in to comment.