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
12 changes: 12 additions & 0 deletions .github/actions/proxy/deploy-proxy/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ inputs:
proxygen-environment:
description: 'Proxygen environment'
required: true
pr-number:
description: 'Pull request number. When provided, appends "(PR-<number>)" to the API title in the proxy specification to distinguish PR-based proxies in the developer portal.'
required: false
default: ""

runs:
using: composite
Expand All @@ -48,6 +52,14 @@ runs:

yq eval '.x-nhsd-apim.target.url = env(TARGET_URL) | .x-nhsd-apim.target.security.secret = env(MTLS_SECRET_NAME)' -i /tmp/proxy-specification.yaml

- name: Append PR number to API title
if: ${{ inputs.pr-number != '' }}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If pr-number is not defined here will it equate to an empty string?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the pr-number is not defined, this step (appending the pr number) will be skipped and the title will be as per the oas file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've explicitly set the default string to empty now.

env:
PR_NUMBER: "${{ inputs.pr-number }}"
shell: bash
run: |
yq eval '.info.title = .info.title + " (PR-" + env(PR_NUMBER) + ")"' -i /tmp/proxy-specification.yaml

- name: Deploy API proxy
env:
ENVIRONMENT: "${{ inputs.proxygen-environment }}"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/preview-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ jobs:
proxygen-client-id: ${{ env.PROXYGEN_CLIENT_ID }}
proxygen-api-name: ${{ env.PROXYGEN_API_NAME }}
proxygen-environment: ${{ env.PROXY_ENV}}
pr-number: ${{ github.event.pull_request.number }}

- name: Deploy int preview API proxy
if: github.event.action != 'closed' && github.event.pull_request.user.login != 'dependabot[bot]'
Expand All @@ -607,6 +608,7 @@ jobs:
proxygen-client-id: ${{ env.PROXYGEN_CLIENT_ID }}
proxygen-api-name: ${{ env.PROXYGEN_API_NAME }}
proxygen-environment: ${{ env.PROXY_ENV}}
pr-number: "${{ github.event.pull_request.number }}i"

- name: Tear down preview API proxy
if: github.event.action == 'closed'
Expand Down
Loading