From dda116e30b0ce53e84f80ad339e6945b26294a58 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Thu, 16 Sep 2021 11:04:13 +0300 Subject: [PATCH 1/3] enable automerge Signed-off-by: Vasiliy Tolstov --- .github/stale.sh | 13 ----- .github/workflows/dependabot-automerge.yml | 65 ++++++++++++++++++++++ 2 files changed, 65 insertions(+), 13 deletions(-) delete mode 100755 .github/stale.sh create mode 100644 .github/workflows/dependabot-automerge.yml diff --git a/.github/stale.sh b/.github/stale.sh deleted file mode 100755 index 8a345c4..0000000 --- a/.github/stale.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -ex - -export PATH=$PATH:$(pwd)/bin -export GO111MODULE=on -export GOBIN=$(pwd)/bin - -#go get github.com/rvflash/goup@v0.4.1 - -#goup -v ./... -#go get github.com/psampaz/go-mod-outdated@v0.6.0 -go list -u -m -mod=mod -json all | go-mod-outdated -update -direct -ci || true - -#go list -u -m -json all | go-mod-outdated -update diff --git a/.github/workflows/dependabot-automerge.yml b/.github/workflows/dependabot-automerge.yml new file mode 100644 index 0000000..b9628e7 --- /dev/null +++ b/.github/workflows/dependabot-automerge.yml @@ -0,0 +1,65 @@ +name: "Pull Request Auto Merge" + +on: + workflow_run: + workflows: ["prbuild", "CodeQL"] + types: + - completed + +permissions: + contents: write + pull-requests: write + +jobs: + Dependabot-Automerge: + runs-on: ubuntu-latest + # Contains workaround to execute if dependabot updates the PR by checking for the base branch in the linked PR + # The the github.event.workflow_run.event value is 'push' and not 'pull_request' + if: >- + github.event.workflow_run.conclusion == 'success' + && github.actor == 'dependabot[bot]' + && github.event.sender.login == 'dependabot[bot]' + && github.event.sender.type == 'Bot' + && (github.event.workflow_run.event == 'pull_request' + || (github.event.workflow_run.event == 'push' && github.event.workflow_run.pull_requests[0].base.ref == github.event.repository.default_branch )) + steps: + - name: Approve Changes and Merge changes if label 'dependencies' is set + uses: actions/github-script@v4 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + console.log(context.payload.workflow_run); + + var labelNames = await github.paginate( + github.issues.listLabelsOnIssue, + { + repo: context.repo.repo, + owner: context.repo.owner, + issue_number: context.payload.workflow_run.pull_requests[0].number, + }, + (response) => response.data.map( + (label) => label.name + ) + ); + + console.log(labelNames); + + if (labelNames.includes('dependencies')) { + console.log('Found label'); + + await github.pulls.createReview({ + repo: context.repo.repo, + owner: context.repo.owner, + pull_number: context.payload.workflow_run.pull_requests[0].number, + event: 'APPROVE' + }); + console.log('Approved PR'); + + await github.pulls.merge({ + repo: context.repo.repo, + owner: context.repo.owner, + pull_number: context.payload.workflow_run.pull_requests[0].number, + }); + + console.log('Merged PR'); + } From c93f2fdf3e7dde5d255f561a5bcaafe072e29041 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Fri, 17 Sep 2021 07:48:05 +0300 Subject: [PATCH 2/3] update workflows Signed-off-by: Vasiliy Tolstov --- .github/workflows/codeql-analysis.yml | 4 ++++ .github/workflows/dependabot-automerge.yml | 3 +++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index f4f2152..fa4081e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -12,6 +12,10 @@ name: "CodeQL" on: + workflow_run: + workflows: ["prbuild"] + types: + - completed push: branches: [ master ] pull_request: diff --git a/.github/workflows/dependabot-automerge.yml b/.github/workflows/dependabot-automerge.yml index b9628e7..a4dfa48 100644 --- a/.github/workflows/dependabot-automerge.yml +++ b/.github/workflows/dependabot-automerge.yml @@ -15,6 +15,7 @@ jobs: runs-on: ubuntu-latest # Contains workaround to execute if dependabot updates the PR by checking for the base branch in the linked PR # The the github.event.workflow_run.event value is 'push' and not 'pull_request' + # dont work with multiple workflows when last returns success if: >- github.event.workflow_run.conclusion == 'success' && github.actor == 'dependabot[bot]' @@ -23,6 +24,8 @@ jobs: && (github.event.workflow_run.event == 'pull_request' || (github.event.workflow_run.event == 'push' && github.event.workflow_run.pull_requests[0].base.ref == github.event.repository.default_branch )) steps: + - name: Wait workflows success + uses: ahmadnassri/action-workflow-run-wait@v1 - name: Approve Changes and Merge changes if label 'dependencies' is set uses: actions/github-script@v4 with: From c43d91461e1aca6fc9891391b963803cf39389bf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 17 Sep 2021 08:31:42 +0300 Subject: [PATCH 3/3] Bump github.com/segmentio/encoding from 0.2.19 to 0.2.20 (#46) Bumps [github.com/segmentio/encoding](https://github.com/segmentio/encoding) from 0.2.19 to 0.2.20. - [Release notes](https://github.com/segmentio/encoding/releases) - [Commits](https://github.com/segmentio/encoding/compare/v0.2.19...v0.2.20) --- updated-dependencies: - dependency-name: github.com/segmentio/encoding dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 88e1b94..38e29a1 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/unistack-org/micro-codec-segmentio/v3 go 1.16 require ( - github.com/segmentio/encoding v0.2.19 + github.com/segmentio/encoding v0.2.20 github.com/unistack-org/micro/v3 v3.7.0 google.golang.org/protobuf v1.27.1 ) diff --git a/go.sum b/go.sum index bbc2cd9..c5b8b6a 100644 --- a/go.sum +++ b/go.sum @@ -27,13 +27,15 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= -github.com/klauspost/cpuid/v2 v2.0.5 h1:qnfhwbFriwDIX51QncuNU5mEMf+6KE3t7O8V2KQl3Dg= -github.com/klauspost/cpuid/v2 v2.0.5/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.0.6 h1:dQ5ueTiftKxp0gyjKSx5+8BtPWkyQbd95m8Gys/RarI= +github.com/klauspost/cpuid/v2 v2.0.6/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/segmentio/encoding v0.2.19 h1:Kshkmoz080qvUtdtakR8Bjk2sIlLS8wSvijFMEHRGow= -github.com/segmentio/encoding v0.2.19/go.mod h1:7E68jTSWMnNoYhHi1JbLd7NBSB6XfE4vzqhR88hDBQc= +github.com/segmentio/asm v1.0.0 h1:GMF7/2eLkte13LERSOmPI766AJXJDRlsqqiN8T7Mfmk= +github.com/segmentio/asm v1.0.0/go.mod h1:4EUJGaKsB8ImLUwOGORVsNd9vTRDeh44JGsY4aKp5I4= +github.com/segmentio/encoding v0.2.20 h1:ThEuQ7cvf8iAnZqktmOArOfSodYqIZEKuoe6CdUvcdg= +github.com/segmentio/encoding v0.2.20/go.mod h1:paNNU+VcHW9yV1ErwIsQ6kHjhb3DDemPuvFPo3bgooA= github.com/silas/dag v0.0.0-20210121180416-41cf55125c34/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=