diff --git a/.github/actions/proxy/deploy-proxy/action.yaml b/.github/actions/proxy/deploy-proxy/action.yaml index 9daf583..06a66c8 100644 --- a/.github/actions/proxy/deploy-proxy/action.yaml +++ b/.github/actions/proxy/deploy-proxy/action.yaml @@ -26,6 +26,10 @@ inputs: proxygen-environment: description: 'Proxygen environment' required: true + pr-number: + description: 'Pull request number. When provided, appends "(PR-)" to the API title in the proxy specification to distinguish PR-based proxies in the developer portal.' + required: false + default: "" runs: using: composite @@ -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 != '' }} + 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 }}" diff --git a/.github/workflows/preview-env.yaml b/.github/workflows/preview-env.yaml index ca21e57..f1638f0 100644 --- a/.github/workflows/preview-env.yaml +++ b/.github/workflows/preview-env.yaml @@ -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]' @@ -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'