Skip to content

Commit

Permalink
EXUI-266: Configure github action to update preview deployment id (#3230
Browse files Browse the repository at this point in the history
)
  • Loading branch information
tomxelliott committed Aug 24, 2023
1 parent dfc0c04 commit 5b459c6
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/populate-preview-deployment-id.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Populate Preview Deployment ID

on:
pull_request:
branches:
- master

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.HMCTS_GITHUB_EXUI_APP_ID }}
private_key: ${{ secrets.HMCTS_GITHUB_EXUI_PRIVATE_KEY }}
- uses: actions/checkout@v3
with:
token: ${{ steps.generate-token.outputs.token }}
- name: Populate preview deployment ID
run: |
sed -i 's/PREVIEW_DEPLOYMENT_ID:.*/PREVIEW_DEPLOYMENT_ID: exui-preview-deployment-${{ github.event.number }}/' charts/xui-webapp/values.preview.template.yaml
shell: bash
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "${{ github.event.pull_request.head.ref }}: Setting Preview Deployment ID"
4 changes: 4 additions & 0 deletions api/lib/http/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import axios, { AxiosInstance } from 'axios';
import { errorInterceptor, requestInterceptor, successInterceptor } from '../interceptors';

export const http: AxiosInstance = axios.create({});
const previewDeploymentId: string = process.env.PREVIEW_DEPLOYMENT_ID;

if (previewDeploymentId) {
axios.defaults.headers.common['hmcts-deployment-id'] = previewDeploymentId;
}
axios.defaults.headers.common['Content-Type'] = 'application/json';
http.interceptors.request.use(requestInterceptor);
http.interceptors.response.use(successInterceptor, errorInterceptor);
1 change: 1 addition & 0 deletions charts/xui-webapp/values.preview.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ nodejs:
SERVICES_CASE_JUDICIAL_API: http://rd-judicial-api-aat.service.core-compute-aat.internal
SERVICES_LOCATION_REF_API_URL: http://rd-location-ref-api-aat.service.core-compute-aat.internal
FEATURE_ACCESS_MANAGEMENT_ENABLED: true
PREVIEW_DEPLOYMENT_ID: exui-preview-deployment-3230
keyVaults:
rpx:
secrets:
Expand Down

0 comments on commit 5b459c6

Please sign in to comment.