Skip to content

Commit 887cc05

Browse files
authored
chore: spread release revert (#3918)
1 parent aa23ba8 commit 887cc05

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
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(),

0 commit comments

Comments
 (0)