Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 75 additions & 30 deletions .github/workflows/push-collection-to-postman.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,90 @@
name: Push collection to Postman workspace
name: Push Postman collection changes to public collection
# This workflow pushes any changes to the Postman collections in the repo to the Postman collections within the
# Validated Relationships Service workspace.
# This means that all changes and version control are handled within GitHub for the collections and only once the
# changes have been merged are the public-facing Postman collections updated.
# Please see updated instructions on Confluence for further details about how this workflow fits into that process.
on:
workflow_dispatch:
inputs:
collection:
type: choice
description: Collection to push
options:
- sandbox
- integration
required: true
default: sandbox

workflow_call:
inputs:
collection:
type: string
description: Collection to push
required: true
should_push_sandbox:
type: boolean
description: Push Sandbox collection
default: false
should_push_integration:
type: boolean
description: Push Integration collection
default: false
push:
branches:
- master
paths:
- './postman/validated_relationship_service.**'

jobs:
push-to-postman:
name: Push collection to Postman
detect-changes:
name: Detect which Postman collection has changed
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
outputs:
sandbox: ${{ steps.filter.outputs.sandbox }}
integration: ${{ steps.filter.outputs.integration }}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
sandbox:
- './postman/validated_relationship_service.sandbox.postman_collection.json'
integration:
- './postman/validated_relationship_service.integration.postman_collection.json'

push-sandbox-postman:
name: Push Sandbox collection to Postman
runs-on: ubuntu-latest
needs: [detect-changes]
if: |
always () && (
(github.event_name == 'push' && needs.detect-changes.outputs.sandbox == 'true') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.should_push_sandbox == 'true')
)
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Get collection ID
id: get_collection_id
run: |
if [[ '${{ github.event.inputs.collection }}' == 'sandbox' ]]; then
echo 'collection_id=${{ secrets.POSTMAN_SANDBOX_COLLECTION_ID }}' >> $GITHUB_OUTPUT
else
echo 'collection_id=${{ secrets.POSTMAN_INTEGRATION_COLLECTION_ID }}' >> $GITHUB_OUTPUT
fi
- name: push-to-postman-action
id: process
- name: Push Sandbox Postman collection
id: push_sandbox_postman_collection
uses: gcatanese/push-to-postman-action@main
with:
goal: update
postman-key: ${{ secrets.POSTMAN_API_KEY }}
postman-file: '/postman/validated_relationship_service.${{ github.event.inputs.collection }}.postman_collection.json'
collection-id: ${{ steps.get_collection_id.outputs.collectionId }}
postman-file: './postman/validated_relationship_service.sandbox.postman_collection.json'
collection-id: ${{ secrets.POSTMAN_SANDBOX_COLLECTION_ID }}

push-integration-postman:
name: Push Integration collection to Postman
runs-on: ubuntu-latest
needs: [detect-changes]
if: |
always () && (
(github.event_name == 'push' && needs.detect-changes.outputs.integration == 'true') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.should_push_integration == 'true')
)
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Push Integration Postman collection
id: push_integration_postman_collection
uses: gcatanese/push-to-postman-action@main
with:
goal: update
postman-key: ${{ secrets.POSTMAN_API_KEY }}
postman-file: './postman/validated_relationship_service.integration.postman_collection.json'
collection-id: ${{ secrets.POSTMAN_INTEGRATION_COLLECTION_ID }}
Original file line number Diff line number Diff line change
Expand Up @@ -11052,11 +11052,6 @@
{
"key": "api_base_url",
"value": "https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4"
},
{
"value": "",
"type": "string",
"disabled": true
}
]
}
}
Loading