From de749640b0a99c7b03097809ed1d9652f5ea6f00 Mon Sep 17 00:00:00 2001 From: "aleksej.paschenko" Date: Wed, 8 Nov 2023 16:28:53 +0300 Subject: [PATCH] Create PR in tonapi-go repo with updated sdk --- .../workflows/create-tonapi-go-pull-request.yaml | 16 ++++++++++++++++ Makefile | 16 +++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/create-tonapi-go-pull-request.yaml diff --git a/.github/workflows/create-tonapi-go-pull-request.yaml b/.github/workflows/create-tonapi-go-pull-request.yaml new file mode 100644 index 00000000..42143753 --- /dev/null +++ b/.github/workflows/create-tonapi-go-pull-request.yaml @@ -0,0 +1,16 @@ +name: Create a pull request to update TonAPI SDK + +on: + push: + branches: + - master + +jobs: + update_sdk: + name: Update TonAPI SDK + runs-on: ubuntu-latest + steps: + - name: create pull request + run: make update-sdk + env: + GH_TOKEN: ${{ github.token }} diff --git a/Makefile b/Makefile index 707b4187..251fecd4 100644 --- a/Makefile +++ b/Makefile @@ -19,4 +19,18 @@ install_i18n: git clone https://github.com/mr-tron/go-i18n/ cd go-i18n/v2 && go build -o $GOPATH/bin/goi18n github.com/nicksnyder/go-i18n/v2/goi18n run: - go run cmd/api/main.go \ No newline at end of file + go run cmd/api/main.go + + +TMPDIR := $(shell mktemp -d) +update-sdk: + git clone git@github.com:tonkeeper/tonapi-go.git $(TMPDIR) \ + && cp -v api/openapi.yml $(TMPDIR)/api/openapi.yml \ + && cd $(TMPDIR) \ + && git checkout -b update \ + && go generate \ + && git add . \ + && git commit -m "update sdk" \ + && git push -u origin update -f \ + && gh pr create --title "Update TonAPI SDK" --body "This PR was created automatically" --head update --base main +