From 7c7c93521fb82722881705c21ec924ea753eb545 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sat, 5 Mar 2022 19:14:01 +0300 Subject: [PATCH] update workflows Signed-off-by: Vasiliy Tolstov --- .github/workflows/autoapprove.yml | 20 ++++++++++++++++++++ .github/workflows/automerge.yml | 21 +++++++++++++++++++++ .github/workflows/build.yml | 5 +++-- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/dependabot-automerge.yml | 14 +++++--------- .github/workflows/pr.yml | 5 +++-- grpc.go | 4 +++- 7 files changed, 56 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/autoapprove.yml create mode 100644 .github/workflows/automerge.yml diff --git a/.github/workflows/autoapprove.yml b/.github/workflows/autoapprove.yml new file mode 100644 index 0000000..ebe28c9 --- /dev/null +++ b/.github/workflows/autoapprove.yml @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml new file mode 100644 index 0000000..5ff3f69 --- /dev/null +++ b/.github/workflows/automerge.yml @@ -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}} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 62ec8bc..d8002e9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,7 @@ on: push: branches: - master + - v3 jobs: test: name: test @@ -13,7 +14,7 @@ jobs: with: go-version: 1.16 - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: cache uses: actions/cache@v2 with: @@ -31,7 +32,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: lint uses: golangci/golangci-lint-action@v3.1.0 continue-on-error: true diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b50aad2..9b4d428 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -43,7 +43,7 @@ jobs: steps: - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: setup uses: actions/setup-go@v2 with: diff --git a/.github/workflows/dependabot-automerge.yml b/.github/workflows/dependabot-automerge.yml index 26cf8ca..3681028 100644 --- a/.github/workflows/dependabot-automerge.yml +++ b/.github/workflows/dependabot-automerge.yml @@ -1,4 +1,4 @@ -name: "prautomerge" +name: "dependabot-automerge" on: pull_request_target: @@ -9,21 +9,17 @@ permissions: contents: write jobs: - dependabot: + automerge: runs-on: ubuntu-latest - if: ${{ github.actor == 'dependabot[bot]' }} + if: github.actor == 'dependabot[bot]' steps: - name: metadata id: metadata - uses: dependabot/fetch-metadata@v1.2.1 + uses: dependabot/fetch-metadata@v1.3.0 with: 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 + id: merge if: ${{contains(steps.metadata.outputs.dependency-names, 'go.unistack.org')}} run: gh pr merge --auto --merge "$PR_URL" env: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 3567fbd..ff10c46 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -3,6 +3,7 @@ on: pull_request: branches: - master + - v3 jobs: test: name: test @@ -13,7 +14,7 @@ jobs: with: go-version: 1.16 - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: cache uses: actions/cache@v2 with: @@ -31,7 +32,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: lint uses: golangci/golangci-lint-action@v3.1.0 continue-on-error: true diff --git a/grpc.go b/grpc.go index c226285..de19c45 100644 --- a/grpc.go +++ b/grpc.go @@ -669,7 +669,6 @@ func (g *grpcClient) publish(ctx context.Context, ps []client.Message, opts ...c for _, p := range ps { md := metadata.Copy(omd) md[metadata.HeaderContentType] = p.ContentType() - md[metadata.HeaderTopic] = p.Topic() // passed in raw data if d, ok := p.Payload().(*codec.Frame); ok { @@ -693,6 +692,9 @@ func (g *grpcClient) publish(ctx context.Context, ps []client.Message, opts ...c topic = exchange } + for k, v := range p.Metadata() { + md.Set(k, v) + } md.Set(metadata.HeaderTopic, topic) msgs = append(msgs, &broker.Message{Header: md, Body: body}) }