updated script to update both v3 and beta for all pushes

This commit is contained in:
Philip Ellis
2023-09-14 10:32:57 -05:00
parent 937a6b7bf5
commit ca2874fb08
3 changed files with 7 additions and 77 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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'