diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 142c2d6056..29712cba0c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -531,7 +531,6 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - ref: ${{ github.event.pull_request.head.ref }} token: ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }} - name: Download all artifacts @@ -571,12 +570,17 @@ jobs: } >> "$GITHUB_OUTPUT" rm -rf tests/output/**/benchmarkResult.json + - name: Extract branch name + id: extract_branch + run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT + - name: Push generated code id: pushGeneratedCode run: yarn workspace scripts pushGeneratedCode env: GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }} PR_NUMBER: ${{ github.event.number }} + BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }} - name: update generation comment uses: marocchino/sticky-pull-request-comment@v2 @@ -663,8 +667,9 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - ref: ${{ github.event.pull_request.head.ref }} + ref: ${{ needs.codegen.outputs.generatedCommit }} token: ${{ secrets.ALGOLIA_BOT_TOKEN }} + repository: ${{ github.event.pull_request.head.repo.full_name }} - name: Setup uses: ./.github/actions/setup diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/RenderingContent.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/RenderingContent.cs index 247d632c76..d0aa9a77fb 100644 --- a/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/RenderingContent.cs +++ b/clients/algoliasearch-client-csharp/algoliasearch/Models/Search/RenderingContent.cs @@ -71,8 +71,8 @@ public override bool Equals(object obj) } return - (FacetOrdering == input.FacetOrdering || (FacetOrdering != null && FacetOrdering.Equals(input.FacetOrdering))) && - (Redirect == input.Redirect || (Redirect != null && Redirect.Equals(input.Redirect))); + (FacetOrdering == input.FacetOrdering || (FacetOrdering != null && FacetOrdering.Equals(input.FacetOrdering))) && + (Redirect == input.Redirect || (Redirect != null && Redirect.Equals(input.Redirect))); } /// diff --git a/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java b/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java index 7cb0afa50c..af9c867aea 100644 --- a/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java +++ b/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java @@ -38,6 +38,11 @@ public class AlgoliaSwiftGenerator extends Swift5ClientCodegen { "aroundradiusall", "automaticfacetfilter", "automaticfacetfilters", + "banner", + "bannerimage", + "bannerimageurl", + "bannerlink", + "banners", "baseindexsettings", "basesearchparams", "basesearchparamswithoutquery", @@ -109,7 +114,8 @@ public class AlgoliaSwiftGenerator extends Swift5ClientCodegen { "timerange", "typotolerance", "typotoleranceenum", - "value" + "value", + "widgets" ); // This is used for the CTS generation diff --git a/scripts/ci/codegen/pushGeneratedCode.ts b/scripts/ci/codegen/pushGeneratedCode.ts index 94887106dc..2912900226 100644 --- a/scripts/ci/codegen/pushGeneratedCode.ts +++ b/scripts/ci/codegen/pushGeneratedCode.ts @@ -8,7 +8,7 @@ import text, { commitStartPrepareRelease } from './text.js'; async function isUpToDate(baseBranch: string): Promise { await run('git fetch origin'); - return (await run(`git pull origin ${baseBranch}`)).includes('Already up to date.'); + return (await run(`git pull origin "${baseBranch}"`)).includes('Already up to date.'); } /** @@ -19,7 +19,7 @@ export async function pushGeneratedCode(): Promise { await configureGitHubAuthor(); - const baseBranch = await run('git branch --show-current'); + const baseBranch = process.env.BRANCH_NAME || (await run('git branch --show-current')); const isMainBranch = baseBranch === MAIN_BRANCH; const IS_RELEASE_COMMIT = (await run('git log -1 --format="%s"')).startsWith(commitStartPrepareRelease); console.log(`Checking codegen status on '${baseBranch}'.`); @@ -41,10 +41,10 @@ export async function pushGeneratedCode(): Promise { const branchToPush = isMainBranch ? baseBranch : `generated/${baseBranch}`; if (!isMainBranch) { - await run(`git push -d origin generated/${baseBranch} || true`); + await run(`git push -d origin "generated/${baseBranch}" || true`); console.log(`Creating branch for generated code: '${branchToPush}'`); - await run(`git checkout -b ${branchToPush}`); + await run(`git checkout -b "${branchToPush}"`); } if (!(await isUpToDate(baseBranch))) { @@ -55,9 +55,9 @@ export async function pushGeneratedCode(): Promise { } const skipCi = isMainBranch ? '[skip ci]' : ''; - let message = await run(`git show -s ${baseBranch} --format="%s ${text.commitEndMessage} ${skipCi}"`); + let message = await run(`git show -s "${baseBranch}" --format="%s ${text.commitEndMessage} ${skipCi}"`); const authors = await run( - `git show -s ${baseBranch} --format=" + `git show -s "${baseBranch}" --format=" Co-authored-by: %an <%ae> %(trailers:key=Co-authored-by)"`, @@ -73,7 +73,7 @@ Co-authored-by: %an <%ae> console.log(`Pushing code to generated branch: '${branchToPush}'`); await run('git add .'); await run(`git commit -m "${message}"`); - await run(`git push origin ${branchToPush}`); + await run(`git push origin "${branchToPush}"`); setOutput('GENERATED_COMMIT', await run('git rev-parse HEAD')); } diff --git a/scripts/ci/utils.ts b/scripts/ci/utils.ts index 140ed5164e..442ec1b6ae 100644 --- a/scripts/ci/utils.ts +++ b/scripts/ci/utils.ts @@ -30,7 +30,7 @@ export async function getNbGitDiff({ return parseInt( ( - await run(`git add -N . && git diff --shortstat ${branch}${checkHead} -- ${path} | wc -l`, { + await run(`git add -N . && git diff --shortstat "${branch}${checkHead}" -- ${path} | wc -l`, { cwd, }) ).trim(), diff --git a/specs/common/schemas/IndexSettings.yml b/specs/common/schemas/IndexSettings.yml index f4e104816d..1b2c635357 100644 --- a/specs/common/schemas/IndexSettings.yml +++ b/specs/common/schemas/IndexSettings.yml @@ -1001,6 +1001,8 @@ renderingContent: $ref: '#/facetOrdering' redirect: $ref: '#/redirectURL' + widgets: + $ref: '#/widgets' x-categories: - Advanced @@ -1022,6 +1024,58 @@ facetOrdering: values: $ref: '#/values' +widgets: + description: widgets returned from any rules that are applied to the current search. + type: object + additionalProperties: false + properties: + banners: + $ref: '#/banners' + +banners: + description: banners defined in the merchandising studio for the given search. + type: array + additionalProperties: false + properties: + banners: + $ref: '#/banner' + +banner: + description: a search banner with image and url. + type: object + additionalProperties: false + properties: + image: + $ref: '#/bannerImage' + link: + $ref: '#/bannerLink' + +bannerLink: + description: link for a banner defined in merchandising studio. + type: object + additionalProperties: false + properties: + url: + type: string + +bannerImage: + description: image of a search banner. + type: object + additionalProperties: false + properties: + urls: + $ref: '#/bannerImageUrl' + title: + type: string + +bannerImageUrl: + description: url for a search banner image. + type: array + additionalProperties: false + properties: + url: + type: string + facets: description: Order of facet names. type: object diff --git a/templates/javascript/clients/algoliasearch/builds/models.mustache b/templates/javascript/clients/algoliasearch/builds/models.mustache index f38dd29c62..4e401fbe4f 100644 --- a/templates/javascript/clients/algoliasearch/builds/models.mustache +++ b/templates/javascript/clients/algoliasearch/builds/models.mustache @@ -13,6 +13,11 @@ import type { AroundRadiusAll, AutomaticFacetFilter, AutomaticFacetFilters, + Banner, + BannerImage, + BannerImageUrl, + BannerLink, + Banners, BaseIndexSettings, BaseSearchParams, BaseSearchParamsWithoutQuery, @@ -79,6 +84,7 @@ import type { TypoTolerance, TypoToleranceEnum, Value, + Widgets, } from '@algolia/client-search'; import { apiClientVersion } from '@algolia/client-search'; import type { RecommendClient } from '@algolia/recommend'; @@ -103,6 +109,11 @@ export { AroundRadiusAll, AutomaticFacetFilter, AutomaticFacetFilters, + Banner, + BannerImage, + BannerImageUrl, + BannerLink, + Banners, BaseIndexSettings, BaseSearchParams, BaseSearchParamsWithoutQuery, @@ -170,6 +181,7 @@ export { TypoTolerance, TypoToleranceEnum, Value, + Widgets, }; /**