Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): do not create release issue if there is no new commit #468

Merged
merged 2 commits into from
May 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions scripts/release/create-release-issue.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable no-console */
import chalk from 'chalk';
import dotenv from 'dotenv';
import semver from 'semver';

Expand Down Expand Up @@ -218,7 +219,18 @@ async function createReleaseIssue(): Promise<void> {
await run(`git log --oneline --abbrev=8 ${RELEASED_TAG}..${MAIN_BRANCH}`)
)
.split('\n')
.filter(Boolean)
.filter(Boolean);

if (latestCommits.length === 0) {
console.log(
chalk.bgYellow('[INFO]'),
`Skipping release because no commit has been added since \`releated\` tag.`
);
// eslint-disable-next-line no-process-exit
process.exit(0);
}

const validCommits = latestCommits
.map((commitMessage) => {
const commit = parseCommit(commitMessage);

Expand All @@ -240,7 +252,7 @@ async function createReleaseIssue(): Promise<void> {

const versions = decideReleaseStrategy({
versions: readVersions(),
commits: latestCommits,
commits: validCommits,
});

const versionChanges = getVersionChangesText(versions);
Expand All @@ -260,7 +272,7 @@ async function createReleaseIssue(): Promise<void> {

return [
`### ${lang}`,
...latestCommits
...validCommits
.filter((commit) => commit.lang === lang)
.map((commit) => `- ${commit.raw}`),
];
Expand Down