Skip to content

Commit be963bd

Browse files
authored
Merge pull request #18 from AI21Labs/rc_initial_version
feat: Initial Version
2 parents 40e0a78 + 718e9a0 commit be963bd

Some content is hidden

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

54 files changed

+13067
-8820
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1 @@
1-
# Lines starting with '#' are comments.
2-
# Each line is a file pattern followed by one or more owners.
3-
4-
# More details are here: https://help.github.com/articles/about-codeowners/
5-
6-
# The '*' pattern is global owners.
7-
8-
# Order is important. The last matching pattern has the most precedence.
9-
# The folders are ordered as follows:
10-
11-
# In each subsection folders are ordered first by depth, then alphabetically.
12-
# This should make it easy to add new rules without breaking existing ones.
13-
14-
# The following GitHub teams can be used within this file:
15-
# @AI21/devops
16-
# @AI21/writing
1+
* @reach
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: Josephasafg, pazshalev, amirai21, miri-bar
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Version [e.g. 22]
29+
- Browser [e.g. chrome, safari]
30+
31+
**Additional context**
32+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/labeler.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Add 'Documentation' label to any change to .md files within the entire repository
2+
documentation:
3+
- changed-files:
4+
- any-glob-to-any-file: "**/*.md"
5+
6+
# Add 'feature' label to any PR where the head branch name starts with `feature` or has a `feature` section in the name
7+
feature:
8+
- head-branch: ["^feat", "feat:"]
9+
10+
# Add 'release' label to any PR that is opened against the `main` branch
11+
fix:
12+
- head-branch: ["^bugfix", "fix:"]
13+
14+
ci:
15+
- head-branch: ["^ci", "ci:"]
16+
- changed-files:
17+
- any-glob-to-any-file:
18+
- .github/*
19+
20+
aws:
21+
- changed-files:
22+
- any-glob-to-any-file:
23+
- ai21/clients/bedrock/*
24+
- ai21/clients/sagemaker/*
25+
26+
azure:
27+
- changed-files:
28+
- any-glob-to-any-file:
29+
- ai21/clients/azure/*
30+
31+
vertex:
32+
- changed-files:
33+
- any-glob-to-any-file:
34+
- ai21/clients/vertex/*

.github/workflows/labeler.yml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: "Pull Request Labeler"
2+
on:
3+
pull_request_review:
4+
types: [submitted]
5+
pull_request_review_comment:
6+
types: [created, deleted]
7+
pull_request_target:
8+
types: [opened, edited, reopened, synchronize]
9+
10+
jobs:
11+
labeler:
12+
permissions:
13+
contents: read
14+
pull-requests: write
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v3
19+
20+
- name: Labeler
21+
uses: actions/labeler@v5
22+
with:
23+
repo-token: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Fetch all branches
26+
run: git fetch --all
27+
28+
- name: Determine base and head branches
29+
id: branches
30+
run: |
31+
base_branch=$(jq -r '.pull_request.base.ref' "$GITHUB_EVENT_PATH")
32+
head_branch=$(jq -r '.pull_request.head.ref' "$GITHUB_EVENT_PATH")
33+
echo $base_branch
34+
echo $head_branch
35+
echo "base_branch=$base_branch" >> $GITHUB_ENV
36+
echo "head_branch=$head_branch" >> $GITHUB_ENV
37+
38+
- name: Calculate diff size
39+
id: diff
40+
env:
41+
BASE_BRANCH: ${{ env.base_branch }}
42+
HEAD_BRANCH: ${{ env.head_branch }}
43+
run: |
44+
echo $BASE_BRANCH
45+
echo $HEAD_BRANCH
46+
git checkout $HEAD_BRANCH
47+
git fetch origin $BASE_BRANCH
48+
diff_output=$(git diff --shortstat origin/$BASE_BRANCH...$HEAD_BRANCH)
49+
echo $diff_output
50+
insertions=$(echo $diff_output | awk '{print ($4 == "" ? 0 : $4)}')
51+
deletions=$(echo $diff_output | awk '{print ($6 == "" ? 0 : $6)}')
52+
changed_lines=$((insertions + deletions))
53+
echo $changed_lines
54+
echo "changed_lines=$changed_lines" >> $GITHUB_ENV
55+
56+
- name: Determine label
57+
env:
58+
CHANGED_LINES: ${{ env.changed_lines }}
59+
id: label
60+
run: |
61+
changed_lines=$CHANGED_LINES
62+
if [ "$changed_lines" -le 9 ]; then
63+
label="size:s"
64+
elif [ "$changed_lines" -le 50 ]; then
65+
label="size:m"
66+
elif [ "$changed_lines" -le 100 ]; then
67+
label="size:l"
68+
elif [ "$changed_lines" -le 500 ]; then
69+
label="size:xl"
70+
else
71+
label="size:xxl"
72+
fi
73+
echo "label=$label" >> $GITHUB_ENV
74+
75+
- name: Fetch current labels
76+
id: fetch_labels
77+
uses: actions/github-script@v7
78+
with:
79+
github-token: ${{ secrets.GITHUB_TOKEN }}
80+
script: |
81+
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
82+
owner: context.repo.owner,
83+
repo: context.repo.repo,
84+
issue_number: context.issue.number,
85+
});
86+
return labels.map(label => label.name);
87+
88+
- name: Remove old size labels
89+
id: remove_labels
90+
uses: actions/github-script@v7
91+
env:
92+
NEW_SIZE_LABEL: ${{ env.label }}
93+
with:
94+
github-token: ${{ secrets.GITHUB_TOKEN }}
95+
script: |
96+
const sizeLabels = ['size:s', 'size:m', 'size:l', 'size:xl', 'size:xxl'];
97+
const newLabel = "${{ env.NEW_SIZE_LABEL }}";
98+
const currentLabels = ${{ steps.fetch_labels.outputs.result }};
99+
const labelsToRemove = currentLabels.filter(label => sizeLabels.includes(label) && label !== newLabel);
100+
for (const label of labelsToRemove) {
101+
await github.rest.issues.removeLabel({
102+
owner: context.repo.owner,
103+
repo: context.repo.repo,
104+
issue_number: context.issue.number,
105+
name: label,
106+
});
107+
}
108+
109+
- name: Add label to PR
110+
uses: actions-ecosystem/action-add-labels@v1
111+
with:
112+
github_token: ${{ secrets.GITHUB_TOKEN }}
113+
labels: ${{ env.label }}
114+
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
125+
with:
126+
github_token: ${{ secrets.GITHUB_TOKEN }}
127+
labels: lgtm

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424

2525
- name: Install semantic-release
2626
run: |
27-
npm install --save-dev semantic-release @semantic-release/git @semantic-release/github
27+
npm install --save-dev semantic-release @semantic-release/git @semantic-release/github @semantic-release/exec
2828
2929
- name: Build package
3030
run: npm run build

.github/workflows/semantic-pr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,7 @@ jobs:
2121
requireScope: false
2222
wip: true
2323
validateSingleCommit: true
24+
scopes: |
25+
deps-dev
2426
env:
2527
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/unittests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Unittest
22

3-
on: [push, pull_request]
3+
on: [push]
44

55
jobs:
66
test:

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,5 @@ dist/
123123
node_modules/
124124
.cursorrules
125125
.vscode/
126-
coverage/
126+
coverage/
127+
.env*

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npm run quality:fix

0 commit comments

Comments
 (0)