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

fix(scripts): remove generation commit from changelogs #534

Merged
merged 2 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions playground/javascript/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"start": "parcel index.html"
},
"dependencies": {
"@experimental-api-clients-automation/client-common": "0.2.0",
"@experimental-api-clients-automation/client-search": "0.2.0",
"@experimental-api-clients-automation/requester-browser-xhr": "0.2.0"
"@experimental-api-clients-automation/client-common": "0.3.0",
"@experimental-api-clients-automation/client-search": "0.3.0",
"@experimental-api-clients-automation/requester-browser-xhr": "0.3.0"
},
"devDependencies": {
"parcel": "2.4.1",
Expand Down
24 changes: 12 additions & 12 deletions playground/javascript/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
"start:predict": "ts-node predict.ts"
},
"dependencies": {
"@experimental-api-clients-automation/algoliasearch": "0.2.0",
"@experimental-api-clients-automation/client-abtesting": "0.2.0",
"@experimental-api-clients-automation/client-analytics": "0.2.0",
"@experimental-api-clients-automation/client-common": "0.2.0",
"@experimental-api-clients-automation/client-insights": "0.2.0",
"@experimental-api-clients-automation/client-personalization": "0.2.0",
"@experimental-api-clients-automation/client-predict": "0.2.0",
"@experimental-api-clients-automation/client-query-suggestions": "0.2.0",
"@experimental-api-clients-automation/client-search": "0.2.0",
"@experimental-api-clients-automation/client-sources": "0.2.0",
"@experimental-api-clients-automation/recommend": "0.2.0",
"@experimental-api-clients-automation/requester-node-http": "0.2.0"
"@experimental-api-clients-automation/algoliasearch": "0.3.0",
"@experimental-api-clients-automation/client-abtesting": "0.3.0",
"@experimental-api-clients-automation/client-analytics": "0.3.0",
"@experimental-api-clients-automation/client-common": "0.3.0",
"@experimental-api-clients-automation/client-insights": "0.3.0",
"@experimental-api-clients-automation/client-personalization": "0.3.0",
"@experimental-api-clients-automation/client-predict": "0.3.0",
"@experimental-api-clients-automation/client-query-suggestions": "0.3.0",
"@experimental-api-clients-automation/client-search": "0.3.0",
"@experimental-api-clients-automation/client-sources": "0.3.0",
"@experimental-api-clients-automation/recommend": "0.3.0",
"@experimental-api-clients-automation/requester-node-http": "0.3.0"
},
"devDependencies": {
"dotenv": "16.0.0",
Expand Down
9 changes: 9 additions & 0 deletions scripts/release/__tests__/create-release-issue.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import generationCommitText from '../../ci/codegen/text';
import {
parseCommit,
getVersionChangesText,
Expand Down Expand Up @@ -49,6 +50,14 @@ describe('create release issue', () => {
error: 'unknown-language-scope',
});
});

it('returns error when it is a generated commit', () => {
expect(
parseCommit(`${generationCommitText.commitStartMessage} ABCDEF`)
).toEqual({
error: 'generation-commit',
});
});
});

describe('getVersionChangesText', () => {
Expand Down
13 changes: 13 additions & 0 deletions scripts/release/create-release-issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import chalk from 'chalk';
import dotenv from 'dotenv';
import semver from 'semver';

import generationCommitText from '../ci/codegen/text';
import {
LANGUAGES,
ROOT_ENV_PATH,
Expand Down Expand Up @@ -99,6 +100,12 @@ export function parseCommit(commit: string): Commit {
let type = message.slice(0, message.indexOf(':'));
const matchResult = type.match(/(.+)\((.+)\)/);
if (!matchResult) {
if (commit.startsWith(generationCommitText.commitStartMessage)) {
return {
error: 'generation-commit',
};
}

return {
error: 'missing-language-scope',
};
Expand Down Expand Up @@ -237,6 +244,12 @@ async function createReleaseIssue(): Promise<void> {
const commit = parseCommit(commitMessage);

if ('error' in commit) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could have 'error: null' in ParsedCommit for a cleaner check here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, will also apply it!

// We don't do anything in that case, as we don't really care about
// those commits
if (commit.error === 'generation-commit') {
return undefined;
}

if (commit.error === 'missing-language-scope') {
commitsWithoutLanguageScope.push(commitMessage);
return undefined;
Expand Down
4 changes: 4 additions & 0 deletions scripts/release/process-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ async function processRelease(): Promise<void> {
});
}

// We need to run a `yarn install` at this point in case the JavaScript client has changed,
// otherwise we will grab dependencies from the remote
await run('YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install');

// We push commits to each repository AFTER all the generations are done.
// Otherwise, we will end up having broken release.
for (const [lang, { current, releaseType }] of Object.entries(
Expand Down
1 change: 1 addition & 0 deletions scripts/release/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export type PassedCommit = {

export type Commit =
| PassedCommit
| { error: 'generation-commit' }
| { error: 'missing-language-scope' }
| { error: 'unknown-language-scope' };

Expand Down
24 changes: 12 additions & 12 deletions tests/output/javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
"test": "jest"
},
"dependencies": {
"@experimental-api-clients-automation/algoliasearch-lite": "0.2.0",
"@experimental-api-clients-automation/client-abtesting": "0.2.0",
"@experimental-api-clients-automation/client-analytics": "0.2.0",
"@experimental-api-clients-automation/client-common": "0.2.0",
"@experimental-api-clients-automation/client-insights": "0.2.0",
"@experimental-api-clients-automation/client-personalization": "0.2.0",
"@experimental-api-clients-automation/client-predict": "0.2.0",
"@experimental-api-clients-automation/client-query-suggestions": "0.2.0",
"@experimental-api-clients-automation/client-search": "0.2.0",
"@experimental-api-clients-automation/client-sources": "0.2.0",
"@experimental-api-clients-automation/recommend": "0.2.0",
"@experimental-api-clients-automation/requester-node-http": "0.2.0"
"@experimental-api-clients-automation/algoliasearch-lite": "0.3.0",
"@experimental-api-clients-automation/client-abtesting": "0.3.0",
"@experimental-api-clients-automation/client-analytics": "0.3.0",
"@experimental-api-clients-automation/client-common": "0.3.0",
"@experimental-api-clients-automation/client-insights": "0.3.0",
"@experimental-api-clients-automation/client-personalization": "0.3.0",
"@experimental-api-clients-automation/client-predict": "0.3.0",
"@experimental-api-clients-automation/client-query-suggestions": "0.3.0",
"@experimental-api-clients-automation/client-search": "0.3.0",
"@experimental-api-clients-automation/client-sources": "0.3.0",
"@experimental-api-clients-automation/recommend": "0.3.0",
"@experimental-api-clients-automation/requester-node-http": "0.3.0"
},
"devDependencies": {
"@types/jest": "27.4.1",
Expand Down
Loading