From a3abb0b0a188d894536bacc66dbf59aeec144c96 Mon Sep 17 00:00:00 2001 From: Sam Kim Date: Thu, 7 Sep 2023 12:56:30 -0700 Subject: [PATCH] Enable automatic updates of client lib in response to api_update --- .github/workflows/automatic-api-update.yaml | 39 +++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/automatic-api-update.yaml diff --git a/.github/workflows/automatic-api-update.yaml b/.github/workflows/automatic-api-update.yaml new file mode 100644 index 00000000..5900a305 --- /dev/null +++ b/.github/workflows/automatic-api-update.yaml @@ -0,0 +1,39 @@ +name: "Called update for API change" +on: + repository_dispatch: + types: ["api_update"] +jobs: + test: + name: "Create PR for API update" + timeout-minutes: 10 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + - name: "Update Buf Script" + id: buf-update + uses: authzed/actions/buf-api-update@main + with: + api-commit: "${{ github.event.client_payload.BUFTAG }}" + spec-path: build.gradle + file-format: gradle + - name: "Output update status" + env: + UPDATED_STATUS: ${{ steps.buf-update.outputs.updated }} + run: | + echo "Update status: $UPDATED_STATUS" + - name: "Update README package version" + uses: authzed/actions/semver-update@main + if: steps.buf-update.outputs.updated == 'true' + with: + sourcefile-path: README.md + version-regex: 'authzed<\/artifactId>\s+(.+)<\/version>' + version-change: minor + - name: Create Pull Request + uses: peter-evans/create-pull-request@v4.0.4 + if: steps.buf-update.outputs.updated == 'true' + with: + delete-branch: "true" + title: "Update API to ${{ github.event.client_payload.BUFTAG }}" + branch: "api-change/${{ github.event.client_payload.BUFTAG }}" + token: ${{ secrets.GITHUB_TOKEN }}