Skip to content

Commit 2e5fa2d

Browse files
authored
Merge branch 'main' into chore/revert-release
2 parents eab7aa5 + cf65d54 commit 2e5fa2d

File tree

24 files changed

+82
-86
lines changed

24 files changed

+82
-86
lines changed

.github/workflows/check.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ jobs:
2121
notification:
2222
runs-on: ubuntu-22.04
2323
timeout-minutes: 1
24-
if: ${{ github.event.number }}
24+
if: ${{ !github.event.pull_request.head.repo.fork && github.event.number }}
2525
permissions:
2626
pull-requests: write
2727
steps:
2828
- uses: actions/checkout@v4
2929

3030
- uses: marocchino/sticky-pull-request-comment@v2
3131
with:
32-
GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
32+
GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN }}
3333
message: |
3434
### 🪓 The generated code will be pushed at the end of the CI.
3535
@@ -265,7 +265,7 @@ jobs:
265265
- name: Run e2e CTS
266266
id: cts-e2e
267267
continue-on-error: true
268-
if: ${{ env.ALGOLIA_APPLICATION_ID != '' && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
268+
if: ${{ !github.event.pull_request.head.repo.fork && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
269269
run: yarn cli cts run javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }} --no-client --no-requests
270270

271271
- name: Retry e2e CTS
@@ -379,7 +379,7 @@ jobs:
379379
- name: Run e2e CTS
380380
id: cts-e2e
381381
continue-on-error: true
382-
if: ${{ env.ALGOLIA_APPLICATION_ID != '' && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
382+
if: ${{ !github.event.pull_request.head.repo.fork && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
383383
run: yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --no-client --no-requests
384384

385385
- name: Retry e2e CTS
@@ -482,24 +482,24 @@ jobs:
482482
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
483483

484484
- name: Download artifacts
485-
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
486485
uses: ./scripts/ci/actions/restore-artifacts
486+
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
487487
with:
488488
type: languages
489489
languages: |
490490
swift
491491
492492
- name: Setup
493-
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
494493
uses: ./.github/actions/setup
494+
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
495495
with:
496496
type: minimal
497497
language: swift
498498
version: ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).version }}
499499

500500
- name: Run tests on macOS
501-
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
502501
id: run-test
502+
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
503503
continue-on-error: true
504504
run: yarn cli cts run swift ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).toRun }} -v ${{ !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') && '--no-e2e' || '' }}
505505

@@ -533,6 +533,7 @@ jobs:
533533
fetch-depth: 0
534534
ref: ${{ github.event.pull_request.head.ref }}
535535
token: ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
536+
repository: ${{ github.event.pull_request.head.repo.full_name }}
536537

537538
- name: Download all artifacts
538539
uses: ./scripts/ci/actions/restore-artifacts
@@ -571,17 +572,12 @@ jobs:
571572
} >> "$GITHUB_OUTPUT"
572573
rm -rf tests/output/**/benchmarkResult.json
573574
574-
- name: Extract branch name
575-
id: extract_branch
576-
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
577-
578575
- name: Push generated code
579576
id: pushGeneratedCode
580577
run: yarn workspace scripts pushGeneratedCode
581578
env:
582579
GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
583580
PR_NUMBER: ${{ github.event.number }}
584-
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }}
585581

586582
- name: update generation comment
587583
uses: marocchino/sticky-pull-request-comment@v2

scripts/ci/codegen/pushGeneratedCode.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import text, { commitStartPrepareRelease } from './text.js';
88

99
async function isUpToDate(baseBranch: string): Promise<boolean> {
1010
await run('git fetch origin');
11-
return (await run(`git pull origin "${baseBranch}"`)).includes('Already up to date.');
11+
return (await run(`git pull origin ${baseBranch}`)).includes('Already up to date.');
1212
}
1313

1414
/**
@@ -19,7 +19,7 @@ export async function pushGeneratedCode(): Promise<void> {
1919

2020
await configureGitHubAuthor();
2121

22-
const baseBranch = process.env.BRANCH_NAME || (await run('git branch --show-current'));
22+
const baseBranch = await run('git branch --show-current');
2323
const isMainBranch = baseBranch === MAIN_BRANCH;
2424
const IS_RELEASE_COMMIT = (await run('git log -1 --format="%s"')).startsWith(commitStartPrepareRelease);
2525
console.log(`Checking codegen status on '${baseBranch}'.`);
@@ -41,10 +41,10 @@ export async function pushGeneratedCode(): Promise<void> {
4141
const branchToPush = isMainBranch ? baseBranch : `generated/${baseBranch}`;
4242

4343
if (!isMainBranch) {
44-
await run(`git push -d origin "generated/${baseBranch}" || true`);
44+
await run(`git push -d origin generated/${baseBranch} || true`);
4545

4646
console.log(`Creating branch for generated code: '${branchToPush}'`);
47-
await run(`git checkout -b "${branchToPush}"`);
47+
await run(`git checkout -b ${branchToPush}`);
4848
}
4949

5050
if (!(await isUpToDate(baseBranch))) {
@@ -55,9 +55,9 @@ export async function pushGeneratedCode(): Promise<void> {
5555
}
5656

5757
const skipCi = isMainBranch ? '[skip ci]' : '';
58-
let message = await run(`git show -s "${baseBranch}" --format="%s ${text.commitEndMessage} ${skipCi}"`);
58+
let message = await run(`git show -s ${baseBranch} --format="%s ${text.commitEndMessage} ${skipCi}"`);
5959
const authors = await run(
60-
`git show -s "${baseBranch}" --format="
60+
`git show -s ${baseBranch} --format="
6161
6262
Co-authored-by: %an <%ae>
6363
%(trailers:key=Co-authored-by)"`,
@@ -73,7 +73,7 @@ Co-authored-by: %an <%ae>
7373
console.log(`Pushing code to generated branch: '${branchToPush}'`);
7474
await run('git add .');
7575
await run(`git commit -m "${message}"`);
76-
await run(`git push origin "${branchToPush}"`);
76+
await run(`git push origin ${branchToPush}`);
7777

7878
setOutput('GENERATED_COMMIT', await run('git rev-parse HEAD'));
7979
}

scripts/ci/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export async function getNbGitDiff({
3030

3131
const changes = parseInt(
3232
(
33-
await run(`git add -N . && git diff --shortstat "${branch}${checkHead}" -- ${path} | wc -l`, {
33+
await run(`git add -N . && git diff --shortstat ${branch}${checkHead} -- ${path} | wc -l`, {
3434
cwd,
3535
})
3636
).trim(),

tests/output/csharp/src/generated/e2e/Insights.test.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public async Task PushEventsTest1()
6363
Index = "products",
6464
UserToken = "user-123456",
6565
AuthenticatedUserToken = "user-123456",
66-
Timestamp = 1728086400000L,
66+
Timestamp = 1728345600000L,
6767
ObjectIDs = new List<string> { "9780545139700", "9780439784542" },
6868
QueryID = "43b15df305339e827f0ac0bdc5ebcaa7",
6969
}
@@ -76,7 +76,7 @@ public async Task PushEventsTest1()
7676
Index = "products",
7777
UserToken = "user-123456",
7878
AuthenticatedUserToken = "user-123456",
79-
Timestamp = 1728086400000L,
79+
Timestamp = 1728345600000L,
8080
ObjectIDs = new List<string> { "9780545139700", "9780439784542" },
8181
}
8282
),

tests/output/csharp/src/generated/requests/Insights.test.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ await client.PushEventsAsync(
580580
Index = "products",
581581
UserToken = "user-123456",
582582
AuthenticatedUserToken = "user-123456",
583-
Timestamp = 1728086400000L,
583+
Timestamp = 1728345600000L,
584584
ObjectIDs = new List<string> { "9780545139700", "9780439784542" },
585585
QueryID = "43b15df305339e827f0ac0bdc5ebcaa7",
586586
}
@@ -593,7 +593,7 @@ await client.PushEventsAsync(
593593
Index = "products",
594594
UserToken = "user-123456",
595595
AuthenticatedUserToken = "user-123456",
596-
Timestamp = 1728086400000L,
596+
Timestamp = 1728345600000L,
597597
ObjectIDs = new List<string> { "9780545139700", "9780439784542" },
598598
}
599599
),
@@ -605,7 +605,7 @@ await client.PushEventsAsync(
605605
Assert.Equal("/1/events", req.Path);
606606
Assert.Equal("POST", req.Method.ToString());
607607
JsonAssert.EqualOverrideDefault(
608-
"{\"events\":[{\"eventType\":\"conversion\",\"eventName\":\"Product Purchased\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1728086400000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"],\"queryID\":\"43b15df305339e827f0ac0bdc5ebcaa7\"},{\"eventType\":\"view\",\"eventName\":\"Product Detail Page Viewed\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1728086400000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"]}]}",
608+
"{\"events\":[{\"eventType\":\"conversion\",\"eventName\":\"Product Purchased\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1728345600000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"],\"queryID\":\"43b15df305339e827f0ac0bdc5ebcaa7\"},{\"eventType\":\"view\",\"eventName\":\"Product Detail Page Viewed\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1728345600000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"]}]}",
609609
req.Body,
610610
new JsonDiffConfig(false)
611611
);

tests/output/dart/test/requests/insights_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ void main() {
635635
index: "products",
636636
userToken: "user-123456",
637637
authenticatedUserToken: "user-123456",
638-
timestamp: 1728086400000,
638+
timestamp: 1728345600000,
639639
objectIDs: [
640640
"9780545139700",
641641
"9780439784542",
@@ -648,7 +648,7 @@ void main() {
648648
index: "products",
649649
userToken: "user-123456",
650650
authenticatedUserToken: "user-123456",
651-
timestamp: 1728086400000,
651+
timestamp: 1728345600000,
652652
objectIDs: [
653653
"9780545139700",
654654
"9780439784542",
@@ -661,7 +661,7 @@ void main() {
661661
expectPath(request.path, '/1/events');
662662
expect(request.method, 'post');
663663
expectBody(request.body,
664-
"""{"events":[{"eventType":"conversion","eventName":"Product Purchased","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1728086400000,"objectIDs":["9780545139700","9780439784542"],"queryID":"43b15df305339e827f0ac0bdc5ebcaa7"},{"eventType":"view","eventName":"Product Detail Page Viewed","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1728086400000,"objectIDs":["9780545139700","9780439784542"]}]}""");
664+
"""{"events":[{"eventType":"conversion","eventName":"Product Purchased","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1728345600000,"objectIDs":["9780545139700","9780439784542"],"queryID":"43b15df305339e827f0ac0bdc5ebcaa7"},{"eventType":"view","eventName":"Product Detail Page Viewed","index":"products","userToken":"user-123456","authenticatedUserToken":"user-123456","timestamp":1728345600000,"objectIDs":["9780545139700","9780439784542"]}]}""");
665665
},
666666
),
667667
);

tests/output/go/tests/e2e/insights_test.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/output/go/tests/requests/insights_test.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/output/java/src/test/java/com/algolia/e2e/Insights.test.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void pushEventsTest1() {
5050
.setIndex("products")
5151
.setUserToken("user-123456")
5252
.setAuthenticatedUserToken("user-123456")
53-
.setTimestamp(1728086400000L)
53+
.setTimestamp(1728345600000L)
5454
.setObjectIDs(Arrays.asList("9780545139700", "9780439784542"))
5555
.setQueryID("43b15df305339e827f0ac0bdc5ebcaa7"),
5656
new ViewedObjectIDs()
@@ -59,7 +59,7 @@ void pushEventsTest1() {
5959
.setIndex("products")
6060
.setUserToken("user-123456")
6161
.setAuthenticatedUserToken("user-123456")
62-
.setTimestamp(1728086400000L)
62+
.setTimestamp(1728345600000L)
6363
.setObjectIDs(Arrays.asList("9780545139700", "9780439784542"))
6464
)
6565
)

tests/output/java/src/test/java/com/algolia/requests/Insights.test.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ void pushEventsTest1() {
720720
.setIndex("products")
721721
.setUserToken("user-123456")
722722
.setAuthenticatedUserToken("user-123456")
723-
.setTimestamp(1728086400000L)
723+
.setTimestamp(1728345600000L)
724724
.setObjectIDs(Arrays.asList("9780545139700", "9780439784542"))
725725
.setQueryID("43b15df305339e827f0ac0bdc5ebcaa7"),
726726
new ViewedObjectIDs()
@@ -729,7 +729,7 @@ void pushEventsTest1() {
729729
.setIndex("products")
730730
.setUserToken("user-123456")
731731
.setAuthenticatedUserToken("user-123456")
732-
.setTimestamp(1728086400000L)
732+
.setTimestamp(1728345600000L)
733733
.setObjectIDs(Arrays.asList("9780545139700", "9780439784542"))
734734
)
735735
)
@@ -741,9 +741,9 @@ void pushEventsTest1() {
741741
assertDoesNotThrow(() ->
742742
JSONAssert.assertEquals(
743743
"{\"events\":[{\"eventType\":\"conversion\",\"eventName\":\"Product" +
744-
" Purchased\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1728086400000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"],\"queryID\":\"43b15df305339e827f0ac0bdc5ebcaa7\"},{\"eventType\":\"view\",\"eventName\":\"Product" +
744+
" Purchased\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1728345600000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"],\"queryID\":\"43b15df305339e827f0ac0bdc5ebcaa7\"},{\"eventType\":\"view\",\"eventName\":\"Product" +
745745
" Detail Page" +
746-
" Viewed\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1728086400000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"]}]}",
746+
" Viewed\",\"index\":\"products\",\"userToken\":\"user-123456\",\"authenticatedUserToken\":\"user-123456\",\"timestamp\":1728345600000,\"objectIDs\":[\"9780545139700\",\"9780439784542\"]}]}",
747747
req.body,
748748
JSONCompareMode.STRICT
749749
)

0 commit comments

Comments
 (0)