diff --git a/.github/sync.yml b/.github/sync.yml index fdc003a0f..03454c165 100644 --- a/.github/sync.yml +++ b/.github/sync.yml @@ -67,6 +67,10 @@ group: - repos: | OpenIMSDK/OpenKF@main OpenIMSDK/openim-miniprogram-demo@main + OpenIMSDK/docs + OpenIMSDK/chat + OpenIMSDK/community + OpenIMSDK/openim-charts OpenIMSDK/openim-sdk-cpp@main files: - source: LICENSE @@ -80,13 +84,25 @@ group: replace: false - source: .github/workflows/project-progress.yml dest: .github/workflows/project-progress.yml - replace: false + replace: false - source: .github/workflows/help-comment-issue.yml dest: .github/workflows/help-comment-issue.yml replace: false - source: .github/.codecov.yml dest: .github/.codecov.yml replace: false + - source: .github/workflows/cla.yml + dest: .github/workflows/cla.yml + replace: false + - source: .github/workflows/ + dest: .github/workflows/ + replace: false + - source: .github/workflows/auto-assign-issue.yml + dest: .github/workflows/auto-assign-issue.yml + replace: false + - source: .github/workflows/release.yml + dest: .github/workflows/release.yml + replace: false - source: ./scripts/githooks/ dest: ./scripts/githooks/ replace: true \ No newline at end of file diff --git a/.github/workflows/auto-assign-issue.yml b/.github/workflows/auto-assign-issue.yml index 66b30c219..7afebe028 100644 --- a/.github/workflows/auto-assign-issue.yml +++ b/.github/workflows/auto-assign-issue.yml @@ -2,7 +2,6 @@ name: Assign issue to comment author on: issue_comment: types: [created] - jobs: assign-issue: if: contains(github.event.comment.body, '/assign') || contains(github.event.comment.body, '/accept') @@ -11,15 +10,17 @@ jobs: issues: write steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Assign the issue run: | + export LETASE_MILESTONES=$(curl "https://api.github.com/repos/$OWNER/$REPO/milestones" | jq -r 'last(.[]).title') gh issue edit ${{ github.event.issue.number }} --add-assignee "${{ github.event.comment.user.login }}" gh issue edit ${{ github.event.issue.number }} --add-label "triage/accepted" - gh issue comment $ISSUE --body "@${{ github.event.comment.user.login }}, this issue has been assigned to you. We are looking forward to your PR!" + gh issue edit ${{ github.event.issue.number }} --milestone "$LETASE_MILESTONES" + gh issue comment $ISSUE --body "@${{ github.event.comment.user.login }} Glad to see you accepted this issue🤲, this issue has been assigned to you.
I set the milestones for this issue to $LETASE_MILESTONES, we are looking forward to your PR!" env: - GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.REDBOT_GITHUB_TOKEN }} ISSUE: ${{ github.event.issue.html_url }} OWNER: ${{ github.repository_owner }} REPO: ${{ github.event.repository.name }} \ No newline at end of file diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index 15a77da9f..385a50c23 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -1,26 +1,26 @@ -name: Automatic Rebase +name: Assign issue to comment author on: issue_comment: types: [created] jobs: - rebase: - name: Rebase + assign-issue: + if: contains(github.event.comment.body, '/assign') || contains(github.event.comment.body, '/accept') runs-on: ubuntu-latest - if: >- - github.event.issue.pull_request != '' && - ( - contains(github.event.comment.body, '/rebase') || - contains(github.event.comment.body, '/autosquash') - ) + permissions: + issues: write steps: - - name: Checkout the latest code + - name: Checkout code uses: actions/checkout@v3 - with: - token: ${{ secrets.BOT_GITHUB_TOKEN }} - fetch-depth: 0 # otherwise, you will fail to push refs to dest repo - - name: Automatic Rebase - uses: cirrus-actions/rebase@1.8 - with: - autosquash: ${{ contains(github.event.comment.body, '/autosquash') || contains(github.event.comment.body, '/rebase-autosquash') }} + + - name: Assign the issue + run: | + export LETASE_MILESTONES=$(curl 'https://api.github.com/repos/kubecub/github-label-syncer/milestones' | jq -r 'last(.[]).title') + gh issue edit ${{ github.event.issue.number }} --add-assignee "${{ github.event.comment.user.login }}" + gh issue edit ${{ github.event.issue.number }} --add-label "triage/accepted" + gh issue edit ${{ github.event.issue.number }} --milestone "$LETASE_MILESTONES" + gh issue comment $ISSUE --body "@${{ github.event.comment.user.login }} Glad to see you accepted this issue🤲, this issue has been assigned to you. I set the milestones for this issue to $LETASE_MILESTONES, We are looking forward to your PR!" env: - GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} \ No newline at end of file + GH_TOKEN: ${{ secrets.REDBOT_GITHUB_TOKEN }} + ISSUE: ${{ github.event.issue.html_url }} + OWNER: ${{ github.repository_owner }} + REPO: ${{ github.event.repository.name }} \ No newline at end of file diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 6bc295d43..65497a106 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -14,13 +14,12 @@ permissions: env: # Define Open-IM-Server variables here - REMOTE_ORGANIZATION: open-im-server + OPEN_IM_SERVER_REMOTE_ORGANIZATION: openim-sigs REMOTE_REPOSITORY: cla - OPEN_IM_SERVER_CLA_DOCUMENT: https://github.com/openim-sigs/cla/blob/main/README.md - OPEN_IM_SERVER_SIGNATURES_PATH: signatures/openim-server/cla.json + OPEN_IM_SERVER_SIGNATURES_PATH: signatures/${{ github.event.repository.name }}/cla.json + OPEN_IM_SERVER_ALLOWLIST: kubbot,bot* - OPEN_IM_SERVER_REMOTE_ORGANIZATION: openim-sigs jobs: CLAAssistant: @@ -40,9 +39,10 @@ jobs: remote-organization-name: ${{ env.OPEN_IM_SERVER_REMOTE_ORGANIZATION }} remote-repository-name: ${{ env.REMOTE_REPOSITORY }} - create-file-commit-message: '📚 Docs: Creating file for storing ${{ env.REMOTE_ORGANIZATION }} CLA Signatures' - custom-notsigned-prcomment: '💕 Thank you for your contribution and please kindly read and sign our [🎯https://github.com/openim-sigs/cla/blob/main/README.md](https://github.com/openim-sigs/cla/blob/main/README.md)' + + create-file-commit-message: '📚 Docs: Creating file for storing ${{ github.event.repository.name }} CLA Signatures' + custom-notsigned-prcomment: '💕 Thank you for your contribution and please kindly read and sign our [🎯https://github.com/openim-sigs/cla/blob/main/README.md](https://github.com/openim-sigs/cla/blob/main/README.md)
' custom-pr-sign-comment: 'I have read the CLA Document and I hereby sign the CLA' - custom-allsigned-prcomment: '🤖 All Contributors have signed the ${{ env.REMOTE_ORGANIZATION }} [CLA](https://github.com/openim-sigs/cla/blob/main/README.md).' + custom-allsigned-prcomment: '🤖 All Contributors have signed the [${{ github.event.repository.name }} CLA](https://github.com/openim-sigs/cla/blob/main/README.md).
The signed information is recorded [🤖here](https://github.com/openim-sigs/cla/tree/main/signatures/${{ env.OPEN_IM_SERVER_ALLOWLIST }}/cla.json)' # lock-pullrequest-aftermerge: false - if you don't want this bot to automatically lock the pull request after merging (default - true) # use-dco-flag: true - If you are using DCO instead of CLA diff --git a/.github/workflows/project-progress.yml b/.github/workflows/project-progress.yml index 12e8615f4..d0cc10604 100644 --- a/.github/workflows/project-progress.yml +++ b/.github/workflows/project-progress.yml @@ -31,6 +31,6 @@ jobs: steps: - uses: alex-page/github-project-automation-plus@v0.8.3 with: - project: OpenIM 2023 Sprint 🔥 + project: OpenIM-V3.1 column: In Progress repo-token: ${{ secrets.BOT_GITHUB_TOKEN }} \ No newline at end of file diff --git a/pkg/proto/wrapperspb/wrapperspb.go b/pkg/proto/wrapperspb/wrapperspb.go index 093a5ce4c..b7d4b0c31 100644 --- a/pkg/proto/wrapperspb/wrapperspb.go +++ b/pkg/proto/wrapperspb/wrapperspb.go @@ -16,176 +16,142 @@ package wrapperspb import ( "encoding/base64" + "encoding/json" "errors" "strconv" ) -// Double func Double(value float64) *DoubleValue { return &DoubleValue{Value: value} } -// Float func Float(value float32) *FloatValue { return &FloatValue{Value: value} } -// Int64 func Int64(value int64) *Int64Value { return &Int64Value{Value: value} } -// UInt64 func UInt64(value uint64) *UInt64Value { return &UInt64Value{Value: value} } -// Int32 func Int32(value int32) *Int32Value { return &Int32Value{Value: value} } -// UInt32 func UInt32(value uint32) *UInt32Value { return &UInt32Value{Value: value} } -// Bool func Bool(value bool) *BoolValue { return &BoolValue{Value: value} } -// String func String(value string) *StringValue { return &StringValue{Value: value} } -// Bytes func Bytes(value []byte) *BytesValue { return &BytesValue{Value: value} } -// DoublePtr func DoublePtr(value *float64) *DoubleValue { if value == nil { return nil } - return &DoubleValue{Value: *value} } -// FloatPtr func FloatPtr(value *float32) *FloatValue { if value == nil { return nil } - return &FloatValue{Value: *value} } -// Int64Ptr func Int64Ptr(value *int64) *Int64Value { if value == nil { return nil } - return &Int64Value{Value: *value} } -// UInt64Ptr func UInt64Ptr(value *uint64) *UInt64Value { if value == nil { return nil } - return &UInt64Value{Value: *value} } -// Int32Ptr func Int32Ptr(value *int32) *Int32Value { if value == nil { return nil } - return &Int32Value{Value: *value} } -// UInt32Ptr func UInt32Ptr(value *uint32) *UInt32Value { if value == nil { return nil } - return &UInt32Value{Value: *value} } -// BoolPtr func BoolPtr(value *bool) *BoolValue { if value == nil { return nil } - return &BoolValue{Value: *value} } -// StringPtr func StringPtr(value *string) *StringValue { if value == nil { return nil } - return &StringValue{Value: *value} } -// BytesPtr func BytesPtr(value *[]byte) *BytesValue { if value == nil { return nil } - return &BytesValue{Value: *value} } -// UnmarshalJSON func (m *DoubleValue) UnmarshalJSON(p []byte) error { value, err := strconv.ParseFloat(string(p), 64) if err != nil { return err } m.Value = value - return nil } -// MarshalJSON func (m *DoubleValue) MarshalJSON() ([]byte, error) { return []byte(strconv.FormatFloat(m.Value, 'f', -1, 64)), nil } -// UnmarshalJSON func (m *FloatValue) UnmarshalJSON(p []byte) error { value, err := strconv.ParseFloat(string(p), 64) if err != nil { return err } m.Value = float32(value) - return nil } -// MarshalJSON func (m *FloatValue) MarshalJSON() ([]byte, error) { return []byte(strconv.FormatFloat(float64(m.Value), 'f', -1, 32)), nil } -// UnmarshalJSON func (m *Int64Value) UnmarshalJSON(p []byte) error { value, err := strconv.ParseInt(string(p), 10, 64) if err != nil { return err } m.Value = value - return nil } @@ -193,86 +159,66 @@ func (m *Int64Value) MarshalJSON() ([]byte, error) { return []byte(strconv.FormatInt(m.Value, 10)), nil } -// UnmarshalJSON func (m *UInt64Value) UnmarshalJSON(p []byte) error { value, err := strconv.ParseUint(string(p), 10, 64) if err != nil { return err } m.Value = value - return nil } -// MarshalJSON func (m *UInt64Value) MarshalJSON() ([]byte, error) { return []byte(strconv.FormatUint(m.Value, 10)), nil } -// UnmarshalJSON func (m *Int32Value) UnmarshalJSON(p []byte) error { value, err := strconv.ParseInt(string(p), 10, 32) if err != nil { return err } m.Value = int32(value) - return nil } -// MarshalJSON func (m *Int32Value) MarshalJSON() ([]byte, error) { return []byte(strconv.FormatInt(int64(m.Value), 10)), nil } -// UnmarshalJSON func (m *UInt32Value) UnmarshalJSON(p []byte) error { value, err := strconv.ParseUint(string(p), 10, 32) if err != nil { return err } m.Value = uint32(value) - return nil } -// MarshalJSON func (m *UInt32Value) MarshalJSON() ([]byte, error) { return []byte(strconv.FormatUint(uint64(m.Value), 10)), nil } -// UnmarshalJSON func (m *BoolValue) UnmarshalJSON(p []byte) error { value, err := strconv.ParseBool(string(p)) if err != nil { return err } m.Value = value - return nil } -// MarshalJSON func (m *BoolValue) MarshalJSON() ([]byte, error) { return []byte(strconv.FormatBool(m.Value)), nil } -// UnmarshalJSON func (m *StringValue) UnmarshalJSON(p []byte) error { - if len(p) < 2 || p[0] != '"' || p[len(p)-1] != '"' { - return errors.New("invalid string value") - } - m.Value = string(p[1 : len(p)-1]) - - return nil + return json.Unmarshal(p, &m.Value) } -// MarshalJSON func (m *StringValue) MarshalJSON() ([]byte, error) { - return []byte(`"` + m.Value + `"`), nil + return json.Marshal(m.Value) } -// UnmarshalJSON func (m *BytesValue) UnmarshalJSON(p []byte) error { if len(p) < 2 || p[0] != '"' || p[len(p)-1] != '"' { return errors.New("invalid bytes value") @@ -282,48 +228,38 @@ func (m *BytesValue) UnmarshalJSON(p []byte) error { return err } m.Value = value - return nil } -// MarshalJSON func (m *BytesValue) MarshalJSON() ([]byte, error) { return []byte(`"` + base64.StdEncoding.EncodeToString(m.Value) + `"`), nil } -// GetValuePtr func (m *DoubleValue) GetValuePtr() *float64 { if m == nil { return nil } - return &m.Value } -// GetValuePtr func (m *FloatValue) GetValuePtr() *float32 { if m == nil { return nil } - return &m.Value } -// GetValuePtr func (m *Int64Value) GetValuePtr() *int64 { if m == nil { return nil } - return &m.Value } -// GetValuePtr func (m *UInt64Value) GetValuePtr() *uint64 { if m == nil { return nil } - return &m.Value } @@ -331,11 +267,9 @@ func (m *Int32Value) GetValuePtr() *int32 { if m == nil { return nil } - return &m.Value } -// GetValuePtr func (m *UInt32Value) GetValuePtr() *uint32 { if m == nil { return nil @@ -343,29 +277,23 @@ func (m *UInt32Value) GetValuePtr() *uint32 { return &m.Value } -// GetValuePtr func (m *BoolValue) GetValuePtr() *bool { if m == nil { return nil } - return &m.Value } -// GetValuePtr func (m *StringValue) GetValuePtr() *string { if m == nil { return nil } - return &m.Value } -// GetValuePtr func (m *BytesValue) GetValuePtr() *[]byte { if m == nil { return nil } - return &m.Value }