Skip to content

Commit f63a9c8

Browse files
authored
chore(scripts): only warn about breaking changes (#4361)
1 parent f2e89e6 commit f63a9c8

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

.github/workflows/check.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,8 @@ jobs:
319319
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
320320
ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}
321321
MONITORING_API_KEY: ${{ secrets.MONITORING_API_KEY }}
322+
outputs:
323+
hasBreakingChanges: ${{ steps.breakingChanges.outputs.hasBreakingChanges }}
322324
name: client ${{ matrix.client.language }}@${{ matrix.client.version }}
323325
steps:
324326
- uses: actions/checkout@v4
@@ -355,7 +357,8 @@ jobs:
355357
run: yarn cli build playground ${{ matrix.client.language }}
356358

357359
- 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]') }}
360+
id: breakingChanges
361+
if: ${{ github.base_ref == 'main' && matrix.client.language == 'java' && matrix.client.isMainVersion }}
359362
run: |
360363
cd ${{ matrix.client.path }}
361364
exit_code=0
@@ -367,7 +370,9 @@ jobs:
367370
cat $FILE
368371
fi
369372
370-
exit $exit_code
373+
if [[ $exit_code -ne 0 ]]; then
374+
echo "hasBreakingChanges=true" >> $GITHUB_OUTPUT
375+
fi
371376
372377
- name: Remove previous CTS output
373378
run: rm -rf ${{ matrix.client.testsToDelete }} || true
@@ -431,7 +436,7 @@ jobs:
431436
!contains(needs.*.result, 'failure')
432437
outputs:
433438
success: ${{ steps.setoutput.outputs.success }}
434-
name: client kotlin${{ needs.setup.outputs.RUN_MACOS_KOTLIN_BUILD == 'true' && format('@{0}', fromJSON(needs.setup.outputs.KOTLIN_DATA).version) || '' }} macos
439+
name: client kotlin${{ format('@{0}', fromJSON(needs.setup.outputs.KOTLIN_DATA).version) }} macos
435440
steps:
436441
- uses: actions/checkout@v4
437442

@@ -481,7 +486,7 @@ jobs:
481486
MONITORING_API_KEY: ${{ secrets.MONITORING_API_KEY }}
482487
outputs:
483488
success: ${{ steps.setoutput.outputs.success }}
484-
name: client swift${{ needs.setup.outputs.RUN_MACOS_SWIFT_CTS == 'true' && format('@{0}', fromJSON(needs.setup.outputs.SWIFT_DATA).version) || '' }} macos
489+
name: client swift${{ format('@{0}', fromJSON(needs.setup.outputs.SWIFT_DATA).version) }} macos
485490
steps:
486491
- uses: actions/checkout@v4
487492
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
@@ -586,12 +591,25 @@ jobs:
586591
GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
587592
PR_NUMBER: ${{ github.event.number }}
588593

594+
- name: Check for breaking changes
595+
id: breakingChanges
596+
if: ${{ needs.client_gen.outputs.hasBreakingChanges == 'true' }}
597+
run: |
598+
{
599+
echo 'BREAKING_CHANGES_SECTION<<EOF'
600+
echo "# 💥 Breaking changes detected !!"
601+
echo "Either this PR or a previous PR not released yet introduced breaking changes, be careful when merging."
602+
echo "You can find the details in the 'client java@17' CI job."
603+
echo 'EOF'
604+
} >> "$GITHUB_OUTPUT"
605+
589606
- name: update generation comment
590607
uses: marocchino/sticky-pull-request-comment@v2
591608
if: ${{ steps.pushGeneratedCode.outputs.GENERATED_COMMIT == '' }}
592609
with:
593610
GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
594611
message: |
612+
${{ steps.breakingChanges.outputs.BREAKING_CHANGES_SECTION }}
595613
### No code generated
596614
597615
_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 +622,7 @@ jobs:
604622
with:
605623
GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
606624
message: |
625+
${{ steps.breakingChanges.outputs.BREAKING_CHANGES_SECTION }}
607626
### ✔️ Code generated!
608627
609628
| 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)