Skip to content

Commit abad296

Browse files
Moti TenzerMoti Tenzer
authored andcommitted
Merge upstream changes and resolve conflict
2 parents c7749ae + 797b8ac commit abad296

File tree

88 files changed

+2096
-1092
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+2096
-1092
lines changed

.git-hooks/check_api_key.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
# Check for `api_key=` in staged changes
4-
if git diff --cached | grep -q "api_key="; then
4+
if git diff --cached | grep -q -E '\bapi_key=[^"]'; then
55
echo "❌ Commit blocked: Found 'api_key=' in staged changes."
66
exit 1 # Prevent commit
77
fi

.github/labeler.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,9 @@ vertex:
3232
- changed-files:
3333
- any-glob-to-any-file:
3434
- ai21/clients/vertex/*
35+
36+
maestro:
37+
- changed-files:
38+
- any-glob-to-any-file:
39+
- ai21/clients/studio/resources/maestro/*
40+
- ai21/models/maestro/*

.github/workflows/integration-tests.yaml

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ on:
44
push:
55
branches:
66
- main
7-
workflow_dispatch:
8-
inputs:
9-
commit-to-test:
10-
description: "Commit SHA to test"
11-
required: true
12-
type: string
137

148
env:
159
POETRY_VERSION: "1.8"
@@ -26,21 +20,6 @@ jobs:
2620
steps:
2721
- name: Checkout
2822
uses: actions/checkout@v3
29-
with:
30-
ref: ${{ inputs.commit-to-test }}
31-
- name: Set status to pending
32-
if: ${{ github.event_name == 'workflow_dispatch' }}
33-
uses: actions/github-script@v7
34-
with:
35-
script: |
36-
github.rest.repos.createCommitStatus({
37-
owner: context.repo.owner,
38-
repo: context.repo.repo,
39-
sha: '${{ inputs.commit-to-test }}',
40-
state: 'pending',
41-
context: 'Integration Tests',
42-
description: 'Integration tests are in progress'
43-
})
4423
- name: Install Poetry
4524
run: |
4625
pipx install poetry==1.8
@@ -81,29 +60,3 @@ jobs:
8160
path: junit/test-results-${{ matrix.python-version }}.xml
8261
# Use always() to always run this step to publish test results when there are test failures
8362
if: ${{ always() }}
84-
- name: Set status to success
85-
if: ${{ github.event_name == 'workflow_dispatch' && success() }}
86-
uses: actions/github-script@v7
87-
with:
88-
script: |
89-
github.rest.repos.createCommitStatus({
90-
owner: context.repo.owner,
91-
repo: context.repo.repo,
92-
sha: '${{ inputs.commit-to-test }}',
93-
state: 'success',
94-
context: 'Integration Tests',
95-
description: 'Integration tests passed'
96-
})
97-
- name: Set status to failure
98-
if: ${{ github.event_name == 'workflow_dispatch' && failure() }}
99-
uses: actions/github-script@v7
100-
with:
101-
script: |
102-
github.rest.repos.createCommitStatus({
103-
owner: context.repo.owner,
104-
repo: context.repo.repo,
105-
sha: '${{ inputs.commit-to-test }}',
106-
state: 'failure',
107-
context: 'Integration Tests',
108-
description: 'Integration tests failed'
109-
})

.github/workflows/labeler.yml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ jobs:
1313
contents: read
1414
pull-requests: write
1515
runs-on: ubuntu-latest
16+
if: github.event.action == 'synchronize'
1617
steps:
1718
- name: Checkout repository
18-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
1920

2021
- name: Labeler
2122
uses: actions/labeler@v5
@@ -112,16 +113,20 @@ jobs:
112113
github_token: ${{ secrets.GITHUB_TOKEN }}
113114
labels: ${{ env.label }}
114115

115-
add_lgtm_label:
116-
runs-on: ubuntu-latest
117-
if: github.event.review.state == 'APPROVED'
118-
119-
steps:
120-
- name: Checkout repository
121-
uses: actions/checkout@v3
122-
123-
- name: Add LGTM label
124-
uses: actions-ecosystem/action-add-labels@v1
116+
- name: Remove lgtm label on new commits
117+
uses: actions/github-script@v7
125118
with:
126-
github_token: ${{ secrets.GITHUB_TOKEN }}
127-
labels: lgtm
119+
github-token: ${{ secrets.GITHUB_TOKEN }}
120+
script: |
121+
try {
122+
await github.rest.issues.removeLabel({
123+
owner: context.repo.owner,
124+
repo: context.repo.repo,
125+
issue_number: context.issue.number,
126+
name: 'lgtm'
127+
});
128+
} catch (error) {
129+
if (error.status !== 404) {
130+
throw error;
131+
}
132+
}

.github/workflows/pr-approval.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: PR Approval Handler
2+
3+
on:
4+
pull_request_review:
5+
types: [submitted]
6+
7+
env:
8+
POETRY_VERSION: "1.8"
9+
POETRY_URL: https://install.python-poetry.org
10+
11+
jobs:
12+
handle-approval:
13+
if: github.event.review.state == 'APPROVED'
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
statuses: write
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
ref: ${{ github.event.pull_request.head.sha }}
25+
26+
- name: Add lgtm label
27+
uses: actions-ecosystem/action-add-labels@v1
28+
with:
29+
github_token: ${{ secrets.GITHUB_TOKEN }}
30+
labels: lgtm
31+
32+
- name: Enable auto-merge
33+
uses: actions/github-script@v7
34+
with:
35+
script: |
36+
await github.graphql(`
37+
mutation enableAutoMerge($pullRequestId: ID!, $mergeMethod: PullRequestMergeMethod!) {
38+
enablePullRequestAutoMerge(input: {
39+
pullRequestId: $pullRequestId,
40+
mergeMethod: $mergeMethod
41+
}) {
42+
pullRequest {
43+
autoMergeRequest {
44+
enabledAt
45+
mergeMethod
46+
}
47+
}
48+
}
49+
}
50+
`, {
51+
pullRequestId: context.payload.pull_request.node_id,
52+
mergeMethod: 'SQUASH'
53+
});
54+
console.log('Auto-merge enabled with squash method');
55+
56+
- name: Install Poetry
57+
run: |
58+
pipx install poetry==1.8
59+
60+
- name: Set up Python
61+
uses: actions/setup-python@v5
62+
with:
63+
python-version: "3.11"
64+
cache: poetry
65+
cache-dependency-path: poetry.lock
66+
67+
- name: Set Poetry environment
68+
run: |
69+
poetry env use 3.11
70+
poetry cache clear --all pypi
71+
72+
- name: Install dependencies
73+
run: |
74+
poetry install --all-extras
75+
76+
- name: Set status to pending
77+
uses: actions/github-script@v7
78+
with:
79+
script: |
80+
github.rest.repos.createCommitStatus({
81+
owner: context.repo.owner,
82+
repo: context.repo.repo,
83+
sha: '${{ github.event.pull_request.head.sha }}',
84+
state: 'pending',
85+
context: 'Integration Tests',
86+
description: 'Integration tests are running after approval'
87+
})
88+
89+
- name: Run Integration Tests
90+
env:
91+
AI21_API_KEY: ${{ secrets.AI21_API_KEY }}
92+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
93+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
94+
run: |
95+
poetry run pytest tests/integration_tests/
96+
97+
- name: Set status to success
98+
if: success()
99+
uses: actions/github-script@v7
100+
with:
101+
script: |
102+
github.rest.repos.createCommitStatus({
103+
owner: context.repo.owner,
104+
repo: context.repo.repo,
105+
sha: '${{ github.event.pull_request.head.sha }}',
106+
state: 'success',
107+
context: 'Integration Tests',
108+
description: 'Integration tests passed after approval'
109+
})
110+
111+
- name: Set status to failure
112+
if: failure()
113+
uses: actions/github-script@v7
114+
with:
115+
script: |
116+
github.rest.repos.createCommitStatus({
117+
owner: context.repo.owner,
118+
repo: context.repo.repo,
119+
sha: '${{ github.event.pull_request.head.sha }}',
120+
state: 'failure',
121+
context: 'Integration Tests',
122+
description: 'Integration tests failed after approval'
123+
})
124+
125+
- name: Upload pytest integration tests results
126+
uses: actions/upload-artifact@v4
127+
with:
128+
name: pytest-results-pr-approval
129+
path: junit/test-results-*.xml
130+
if: always()

.github/workflows/release_version.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ jobs:
1818
persist-credentials: false
1919

2020
- name: Python Semantic Release
21-
uses: python-semantic-release/python-semantic-release@v9.21.0
21+
uses: python-semantic-release/python-semantic-release@v10.3.0
2222
with:
23-
github_token: ${{ secrets.GH_PAT_SEM_REL_ASAFG }}
23+
github_token: ${{ secrets.GH_PAT_SEM_REL_NISSIM_AI21_PYTHON_SDK }}

.github/workflows/semantic-pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ on:
1313

1414
jobs:
1515
semantic-pr:
16-
runs-on: ubuntu-20.04
16+
runs-on: ubuntu-latest
1717
timeout-minutes: 1
1818
steps:
1919
- name: Semantic pull-request
20-
uses: amannn/action-semantic-pull-request@v5.5.3
20+
uses: amannn/action-semantic-pull-request@v6.0.1
2121
with:
2222
requireScope: false
2323
wip: true

.pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ repos:
88
rev: v4.4.0
99
hooks:
1010
- id: check-added-large-files
11-
exclude: (ai21_tokenizer/resources|tests/resources)
1211
- id: check-case-conflict
1312
- id: check-executables-have-shebangs
1413
- id: check-shebang-scripts-are-executable

0 commit comments

Comments
 (0)