Merge branch 'master' into v3

This commit is contained in:
Василий Толстов 2022-03-21 15:31:11 +03:00
commit 9136addd1e
7 changed files with 61 additions and 14 deletions

20
.github/workflows/autoapprove.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: "autoapprove"
on:
pull_request_target:
types: [assigned, opened, synchronize, reopened]
permissions:
pull-requests: write
contents: write
jobs:
autoapprove:
runs-on: ubuntu-latest
steps:
- name: approve
uses: hmarr/auto-approve-action@v2
if: github.actor == 'vtolstov' || github.actor == 'dependabot[bot]'
id: approve
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

21
.github/workflows/automerge.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: "automerge"
on:
pull_request_target:
types: [assigned, opened, synchronize, reopened]
permissions:
pull-requests: write
contents: write
jobs:
automerge:
runs-on: ubuntu-latest
if: github.actor == 'vtolstov'
steps:
- name: merge
id: merge
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.TOKEN}}

View File

@ -3,6 +3,7 @@ on:
push: push:
branches: branches:
- master - master
- v3
jobs: jobs:
test: test:
name: test name: test
@ -13,7 +14,7 @@ jobs:
with: with:
go-version: 1.17 go-version: 1.17
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: cache - name: cache
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
@ -31,7 +32,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: lint - name: lint
uses: golangci/golangci-lint-action@v3.1.0 uses: golangci/golangci-lint-action@v3.1.0
continue-on-error: true continue-on-error: true

View File

@ -43,7 +43,7 @@ jobs:
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: setup - name: setup
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:

View File

@ -1,4 +1,4 @@
name: "prautomerge" name: "dependabot-automerge"
on: on:
pull_request_target: pull_request_target:
@ -9,21 +9,17 @@ permissions:
contents: write contents: write
jobs: jobs:
dependabot: automerge:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }} if: github.actor == 'dependabot[bot]'
steps: steps:
- name: metadata - name: metadata
id: metadata id: metadata
uses: dependabot/fetch-metadata@v1.1.1 uses: dependabot/fetch-metadata@v1.3.0
with: with:
github-token: "${{ secrets.TOKEN }}" github-token: "${{ secrets.TOKEN }}"
- name: approve
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.TOKEN}}
- name: merge - name: merge
id: merge
if: ${{contains(steps.metadata.outputs.dependency-names, 'go.unistack.org')}} if: ${{contains(steps.metadata.outputs.dependency-names, 'go.unistack.org')}}
run: gh pr merge --auto --merge "$PR_URL" run: gh pr merge --auto --merge "$PR_URL"
env: env:

View File

@ -3,6 +3,7 @@ on:
pull_request: pull_request:
branches: branches:
- master - master
- v3
jobs: jobs:
test: test:
name: test name: test
@ -13,7 +14,7 @@ jobs:
with: with:
go-version: 1.17 go-version: 1.17
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: cache - name: cache
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
@ -31,7 +32,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: lint - name: lint
uses: golangci/golangci-lint-action@v3.1.0 uses: golangci/golangci-lint-action@v3.1.0
continue-on-error: true continue-on-error: true

View File

@ -184,6 +184,14 @@ func (h *httpServer) NewHandler(handler interface{}, opts ...server.HandlerOptio
tp := reflect.TypeOf(handler) tp := reflect.TypeOf(handler)
if len(options.Metadata) == 0 {
if h.registerRPC {
h.opts.Logger.Infof(h.opts.Context, "register rpc handler for http.MethodPost %s /%s", hn, hn)
if err := hdlr.handlers.Insert([]string{http.MethodPost}, "/"+hn, pth); err != nil {
h.opts.Logger.Errorf(h.opts.Context, "cant add rpc handler for http.MethodPost %s /%s", hn, hn)
}
}
}
for hn, md := range options.Metadata { for hn, md := range options.Metadata {
var method reflect.Method var method reflect.Method
mname := hn[strings.Index(hn, ".")+1:] mname := hn[strings.Index(hn, ".")+1:]