Skip to content

fixed workflow syntax #6

fixed workflow syntax

fixed workflow syntax #6

name: Generate OpenAPI Specification
on:
push:
branches:
- main
permissions:
contents: write
jobs:
generate_openapi:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v4
# Step 2: Install curl
- name: Install curl
run: |
sudo apt-get update
sudo apt-get install -y curl
# Step 3: Send Postman Collection to Postman-to-OpenAPI service
- name: Convert Postman Collection to OpenAPI
run: |
curl --request POST \
--url https://demo.postmansolutions.com/postman2openapi \
--header "Content-Type: application/json" \
--data "$(cat APTRS.postman_collection.json)" \
--output OpenAPI.yml
# Step 4: Update servers section using sed
- name: Update Servers Section
run: |
sed -i 's|url: https://live.aptrs.com|&\n description: Local Hosted Server \n - url: https://live.aptrs.com\n description: APTRS Demo Server|g' OpenAPI.yml
# Step 5: Commit and push OpenAPI.yml to the repository
- name: Commit and Push OpenAPI.yml
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
git add OpenAPI.yml
git commit -m "Update OpenAPI.yml from Postman collection"
git push