From ca2874fb08aa5a96c95c273beeaa8e1a8f67435e Mon Sep 17 00:00:00 2001 From: Philip Ellis Date: Thu, 14 Sep 2023 10:32:57 -0500 Subject: [PATCH] updated script to update both v3 and beta for all pushes --- .../build-dereferenced-beta-spec.yml | 32 -------------- ...3-spec.yml => build-dereferenced-spec.yml} | 8 +++- .github/workflows/build-postman-idn-v3.yml | 44 ------------------- 3 files changed, 7 insertions(+), 77 deletions(-) delete mode 100644 .github/workflows/build-dereferenced-beta-spec.yml rename .github/workflows/{build-dereferenced-v3-spec.yml => build-dereferenced-spec.yml} (63%) delete mode 100644 .github/workflows/build-postman-idn-v3.yml diff --git a/.github/workflows/build-dereferenced-beta-spec.yml b/.github/workflows/build-dereferenced-beta-spec.yml deleted file mode 100644 index 259933ce..00000000 --- a/.github/workflows/build-dereferenced-beta-spec.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: "Build Dereferenced IDN Beta" - -on: - push: - branches: - - main - paths: - - idn/sailpoint-api.beta.yaml - - idn/beta/** - workflow_dispatch: - -jobs: - dereference_beta: - runs-on: ubuntu-latest - steps: - - name: Checkout PR branch - uses: actions/checkout@v3 - - name: Set up Node - uses: actions/setup-node@v3 - with: - node-version: "18" - - name: Install swagger-cli and postman - run: | - npm install -g swagger-cli - npm install -g openapi-to-postmanv2 - - name: Dereference Beta API Specification and build Postman collection - run: | - swagger-cli bundle --dereference idn/sailpoint-api.beta.yaml -t yaml -o dereferenced/deref-sailpoint-api.beta.yaml - openapi2postmanv2 -s dereferenced/deref-sailpoint-api.beta.yaml -o postman/collections/sailpoint-api-beta.json -p -O folderStrategy=Tags,requestParametersResolution=Schema,exampleParametersResolution=Schema,disableOptionalParameters=true,optimizeConversion=false,stackLimit=50,alwaysInheritAuthentication=true - node postman-script/modify-collection.js postman/collections/sailpoint-api-beta.json - node postman-script/upload-script.js ${{secrets.POSTMAN_API_KEY}} Beta - - uses: stefanzweifel/git-auto-commit-action@v4 diff --git a/.github/workflows/build-dereferenced-v3-spec.yml b/.github/workflows/build-dereferenced-spec.yml similarity index 63% rename from .github/workflows/build-dereferenced-v3-spec.yml rename to .github/workflows/build-dereferenced-spec.yml index 5ace833f..e1e7f127 100644 --- a/.github/workflows/build-dereferenced-v3-spec.yml +++ b/.github/workflows/build-dereferenced-spec.yml @@ -1,4 +1,4 @@ -name: "Build Dereferenced IDN V3" +name: "Build Dereferenced IDN specs" on: push: @@ -7,6 +7,8 @@ on: paths: - idn/sailpoint-api.v3.yaml - idn/v3/** + - idn/sailpoint-api.beta.yaml + - idn/beta/** workflow_dispatch: jobs: @@ -29,4 +31,8 @@ jobs: openapi2postmanv2 -s dereferenced/deref-sailpoint-api.v3.yaml -o postman/collections/sailpoint-api-v3.json -p -O folderStrategy=Tags,requestParametersResolution=Schema,exampleParametersResolution=Schema,disableOptionalParameters=true,optimizeConversion=false,stackLimit=50,alwaysInheritAuthentication=true node postman-script/modify-collection.js postman/collections/sailpoint-api-v3.json node postman-script/upload-script.js ${{secrets.POSTMAN_API_KEY}} V3 + swagger-cli bundle --dereference idn/sailpoint-api.beta.yaml -t yaml -o dereferenced/deref-sailpoint-api.beta.yaml + openapi2postmanv2 -s dereferenced/deref-sailpoint-api.beta.yaml -o postman/collections/sailpoint-api-beta.json -p -O folderStrategy=Tags,requestParametersResolution=Schema,exampleParametersResolution=Schema,disableOptionalParameters=true,optimizeConversion=false,stackLimit=50,alwaysInheritAuthentication=true + node postman-script/modify-collection.js postman/collections/sailpoint-api-beta.json + node postman-script/upload-script.js ${{secrets.POSTMAN_API_KEY}} Beta - uses: stefanzweifel/git-auto-commit-action@v4 diff --git a/.github/workflows/build-postman-idn-v3.yml b/.github/workflows/build-postman-idn-v3.yml deleted file mode 100644 index 72106f8e..00000000 --- a/.github/workflows/build-postman-idn-v3.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: "Build/Update IDN V3 Postman Collection" - -on: - push: - branches: - - main - paths: - - idn/sailpoint-api.v3.yaml - - idn/v3/** - workflow_dispatch: - -jobs: - dereference_spec: - runs-on: ubuntu-latest - steps: - - name: Checkout PR branch - uses: actions/checkout@v3 - - name: Set up Node - uses: actions/setup-node@v3 - with: - node-version: "16" - - name: Install swagger-cli and openapi-to-postmanv2 - run: | - npm install -g swagger-cli - npm install -g openapi-to-postmanv2 - - name: Dereference API Specification - run: | - swagger-cli bundle --dereference idn/sailpoint-api.v3.yaml -t yaml -o dereferenced/deref-sailpoint-api.v3.yaml - - name: Build postman collection from dereferenced spec - run: | - openapi2postmanv2 -s dereferenced/deref-sailpoint-api.v3.yaml -o collection.json -p -O folderStrategy=Tags,requestParametersResolution=Schema,exampleParametersResolution=Schema,disableOptionalParameters=true,optimizeConversion=false,stackLimit=50 - - echo `jq '.components.securitySchemes.oauth2.flows.clientCredentials.tokenUrl |= "https://{{tenant}}.api.identitynow.com/oauth/token" | \ - .components.securitySchemes.oauth2.flows.authorizationCode.authorizationUrl |= "https://{{tenant}}.api.identitynow.com/oauth/authorize" | \ - .components.securitySchemes.oauth2.flows.authorizationCode.tokenUrl |= "https://{{tenant}}.api.identitynow.com/oauth/token"' collection.json` > collection.json - - name: Wrap collection for postman - run: | - jq '{collection: . }' collection.json > final.json - - name: Upload to postman - run: | - curl --location --request PUT 'https://api.getpostman.com/collections/5f6a4855-8012-406f-9456-c8fa6311b080' \ - --header 'Content-Type: application/json' \ - --header 'X-API-Key: ${{secrets.POSTMAN_API_KEY}}' \ - --data-binary '@final.json' \ No newline at end of file