From cae2b2c48435f928f1aa0f049a7e54608c6cb109 Mon Sep 17 00:00:00 2001 From: Yurii Shynbuiev Date: Wed, 1 May 2024 19:39:22 +0700 Subject: [PATCH] ci: add OAS breaking change detection Signed-off-by: Yurii Shynbuiev --- .github/workflows/oasdiff.yml | 67 +++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/oasdiff.yml diff --git a/.github/workflows/oasdiff.yml b/.github/workflows/oasdiff.yml new file mode 100644 index 0000000000..f6dfd84a17 --- /dev/null +++ b/.github/workflows/oasdiff.yml @@ -0,0 +1,67 @@ +--- +name: "Cloud Agent OAS Breaking changes" +run-name: "Cloud Agent OAS Diff between revision ${{ inputs.revision_tag }} and base ${{ inputs.base_tag }}" + +on: + pull_request: + branches: + - main + + workflow_dispatch: + inputs: + revision_tag: + required: true + type: string + description: "Revision tag to check the breaking changes in the OAS" + base_tag: + required: false + type: string + description: "Base tag to to check the breaking changes in the OAS" + default: "main" + +# https://raw.githubusercontent.com/hyperledger/identus-cloud-agent/prism-agent-v1.29.0/prism-agent/service/api/http/prism-agent-openapi-spec.yaml +# https://raw.githubusercontent.com/hyperledger/identus-cloud-agent/main/cloud-agent/service/api/http/cloud-agent-openapi-spec.yaml + +jobs: + oasdiff-breaking: + name: "Open API specification breaking changes detection" + runs-on: ubuntu-latest + steps: + - name: Resolve the base OpenAPI spec URL + run: | + BASE_TAG="${{ github.event.inputs.base_tag }}" + if [[ BASE_TAG == cloud-agent-v* ]]; then + echo "BASE_URL=https://raw.githubusercontent.com/hyperledger/identus-cloud-agent/$BASE_TAG/cloud-agent/service/api/http/cloud-agent-openapi-spec.yaml" >> $GITHUB_ENV + elif [[ BASE_TAG == prism-agent-v* ]]; then + echo "BASE_URL=https://raw.githubusercontent.com/hyperledger/identus-cloud-agent/$BASE_TAG/prism-agent/service/api/http/prism-agent-openapi-spec.yaml" >> $GITHUB_ENV + elif [[ BASE_TAG == main ]]; then + echo "BASE_URL=https://raw.githubusercontent.com/hyperledger/identus-cloud-agent/$BASE_TAG/cloud-agent/service/api/http/cloud-agent-openapi-spec.yaml" >> $GITHUB_ENV + fi + + - name: Resolve the revision OpenAPI spec URL + run: | + REV_TAG="${{ github.event.inputs.revision_tag }}" + if [[ REV_TAG == cloud-agent-v* ]]; then + echo "REV_URL=https://raw.githubusercontent.com/hyperledger/identus-cloud-agent/$REV_TAG/cloud-agent/service/api/http/cloud-agent-openapi-spec.yaml" >> $GITHUB_ENV + elif [[ REV_TAG == prism-agent-v* ]]; then + echo "REV_URL=https://raw.githubusercontent.com/hyperledger/identus-cloud-agent/$REV_TAG/prism-agent/service/api/http/prism-agent-openapi-spec.yaml" >> $GITHUB_ENV + elif [[ REV_TAG == main ]]; then + echo "REV_URL=https://raw.githubusercontent.com/hyperledger/identus-cloud-agent/$REV_TAG/cloud-agent/service/api/http/cloud-agent-openapi-spec.yaml" >> $GITHUB_ENV + fi + + - name: Check URLS + run: | + echo "Base url: ${{ env.BASE_URL }}" + echo "Revision url: ${{ env.REV_URL}}" + + - name: Running OpenAPI Spec diff action + uses: oasdiff/oasdiff-action/breaking@main + with: + fail-on-diff: false + base: ${{ env.BASE_URL }} + revision: ${{ env.REV_URL }} + + + + +