Skip to content

Commit 48e48c3

Browse files
committed
chore(scripts): only warn about breaking changes
1 parent f2e89e6 commit 48e48c3

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

.github/workflows/check.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ jobs:
355355
run: yarn cli build playground ${{ matrix.client.language }}
356356

357357
- name: Run Java 'algoliasearch' public API validation
358-
if: ${{ github.base_ref == 'main' && matrix.client.language == 'java' && matrix.client.isMainVersion && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-bc]') }}
358+
if: ${{ github.base_ref == 'main' && matrix.client.language == 'java' && matrix.client.isMainVersion }}
359359
run: |
360360
cd ${{ matrix.client.path }}
361361
exit_code=0
@@ -367,7 +367,9 @@ jobs:
367367
cat $FILE
368368
fi
369369
370-
exit $exit_code
370+
if [[ $exit_code -ne 0 ]]; then
371+
echo "hasBreakingChanges=true" >> $GITHUB_OUTPUT
372+
fi
371373
372374
- name: Remove previous CTS output
373375
run: rm -rf ${{ matrix.client.testsToDelete }} || true
@@ -586,12 +588,24 @@ jobs:
586588
GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
587589
PR_NUMBER: ${{ github.event.number }}
588590

591+
- name: Check for breaking changes
592+
id: breakingChanges
593+
if: ${{ needs.client_gen.outputs.hasBreakingChanges == 'true' }}
594+
run: |
595+
{
596+
echo 'BREAKING_CHANGES_SECTION<<EOF'
597+
echo "# 💥 Breaking changes detected !!""
598+
echo "either this PR or a previous PR not released yet introduced breaking changes, be careful when merging."
599+
echo 'EOF'
600+
} >> "$GITHUB_OUTPUT"
601+
589602
- name: update generation comment
590603
uses: marocchino/sticky-pull-request-comment@v2
591604
if: ${{ steps.pushGeneratedCode.outputs.GENERATED_COMMIT == '' }}
592605
with:
593606
GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
594607
message: |
608+
${{ steps.breakingChanges.outputs.BENCHMARK_SECTION }}
595609
### No code generated
596610
597611
_If you believe code should've been generated, please, [report the issue](https://github.com/algolia/api-clients-automation/issues/new?assignees=&labels=bug%2Ctriage&projects=&template=Bug_report.yml&title=%5Bbug%5D%3A+)._
@@ -604,6 +618,7 @@ jobs:
604618
with:
605619
GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
606620
message: |
621+
${{ steps.breakingChanges.outputs.BENCHMARK_SECTION }}
607622
### ✔️ Code generated!
608623
609624
| Name | Link |

scripts/cli/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,14 +303,12 @@ program
303303
)
304304
.option('-d, --dry-run', 'does not push anything to GitHub')
305305
.option('-vh, --versions-history', 'only generates the versions-history policy', false)
306-
.option('-b --breaking', 'allow breaking change on the CI', false)
307-
.action(async ({ verbose, releaseType, dryRun, versionsHistory, breaking }) => {
306+
.action(async ({ verbose, releaseType, dryRun, versionsHistory }) => {
308307
setVerbose(Boolean(verbose));
309308

310309
await createReleasePR({
311310
releaseType,
312311
dryRun,
313-
breaking,
314312
versionsHistory,
315313
});
316314
});

scripts/release/createReleasePR.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,10 @@ async function prepareGitEnvironment(dryRun: boolean): Promise<void> {
341341
export async function createReleasePR({
342342
releaseType,
343343
dryRun,
344-
breaking,
345344
versionsHistory,
346345
}: {
347346
releaseType?: semver.ReleaseType;
348347
dryRun?: boolean;
349-
breaking?: boolean;
350348
versionsHistory?: boolean;
351349
}): Promise<void> {
352350
await prepareGitEnvironment(dryRun || versionsHistory || false);
@@ -418,7 +416,7 @@ export async function createReleasePR({
418416

419417
setVerbose(true);
420418
console.log(`Pushing updated changes to: ${headBranch}`);
421-
const commitMessage = `${generationCommitText.commitPrepareReleaseMessage}${breaking ? ' [skip-bc]' : ''}`;
419+
const commitMessage = generationCommitText.commitPrepareReleaseMessage;
422420
await run('git add .');
423421
await run(`CI=true git commit -m "${commitMessage}"`);
424422

0 commit comments

Comments
 (0)