diff --git a/README.md b/README.md index 8916a7d1..affa0518 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This repository contains the upload compliance state action. -### Development on already existing task (uploadcompliancestatetask) +## Development on upload-compliance-state To start development, create a branch named **feature/your-branch-name**. @@ -20,9 +20,14 @@ npm run format:write Start developing and create tests, to run your test run: `npm run test`. When pushing the code the repository the workflow will build and push your code to the repository. -## Adding a new control to upload +### How to trigger the dev-function for upload-compliance-state +1. Ensure that a secret named ```URLUPDATEDEV``` has been created. [(Read more here on how to create a GitHub secret)](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository) +2. Make sure the secret is set as an environment variable ```urlUpdate``` in the workflow you are invoking. -Start with creating a branch named **feature/your-branch-name**. +``` +env: + urlUpdate: ${{ secrets.URLUPDATEDEV }} +``` ### How to log the badge The UrlBody class contains all the badges/controls that will be logged in the workflow. The UrlBodyBuilder class is responsible for building the UrlBody. To add a badge for logging in the workflow, follow these steps: diff --git a/src/lib/ComplianceStateService.ts b/src/lib/ComplianceStateService.ts index 8231e807..b434a181 100644 --- a/src/lib/ComplianceStateService.ts +++ b/src/lib/ComplianceStateService.ts @@ -12,7 +12,9 @@ export class ComplianceStateService { subscriptionId: string ): Promise { // POST-request to Azure function - const urlUpdate: string = process.env.urlUpdate || ''; + const updateKey: string = process.env.updateKey || ''; + //Please update the func url if there are any changes to the infrastructure. + const urlUpdate: string = process.env.urlUpdate || 'https://func-cydig-comp-state-prod.azurewebsites.net/api/UpdateComplianceState?code=' + updateKey; const bodyBuilder: BodyBuilder = new BodyBuilder(); const responseBody: ResponseBody = bodyBuilder.createBody( teamName, diff --git a/src/lib/UrlBuilder.ts b/src/lib/UrlBuilder.ts index 238fec49..0238d049 100644 --- a/src/lib/UrlBuilder.ts +++ b/src/lib/UrlBuilder.ts @@ -7,15 +7,17 @@ export class UrlBuilder { subscriptionId: string, states: object ): string { - //DonĀ“t forget to implement this as github secrets in the repository - const urlReadToReadMe: string = process.env.urlRead || ''; + //Please update the url if there are any changes to the infrastructure. const urlDashboard: string = "https://cydig.omegapoint.cloud/"; - const readToReadMeKeyAcessKey: string = process.env.readToReadMeKeyAcessKey || ''; + //Please update the func url if there are any changes to the infrastructure. + const readFunctionURL: string = 'https://func-cydig-comp-state-prod.azurewebsites.net/api/ReadToReadme?code='; + //Please update the url if there are any changes to the infrastructure. + const readToReadMeKeyAcessKey: string = 'xaEvCDsaK01y2Z6SBivwOKndN4o915lpOTt1VkmULgsxgsjkml7u1DOhgULzmAPX'; + let urls: string = ''; let encodedURL: string; let singleBadgeURL: string; let redirectLink: string = ''; - const readFunctionURL: string = urlReadToReadMe; //OP Dashboard encodedURL = encodeURIComponent('OP Compliance Dashboard-click here-blue'); @@ -26,7 +28,6 @@ export class UrlBuilder { //timestamp encodedURL = encodeURIComponent( readFunctionURL + - 'code=' + readToReadMeKeyAcessKey + '&teamName=' + encodeURIComponent(teamName) +