From e45afd08c18cc9c25f2915f8b0222c534f5e332b Mon Sep 17 00:00:00 2001 From: Tom Ashworth Date: Mon, 26 Sep 2022 17:22:51 +0100 Subject: [PATCH] tech: refactor github comment to use Capgemini Microsoft Bot (#136) * tech: refactor github comment to use Capgemini Microsoft Bot * feat: conditional run delete github comment * fix: repo owner and name passed together * fix: `dependencies` to `stageDependencies` * fix: set comment id to a variable --- templates/build-and-test-stages.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/templates/build-and-test-stages.yml b/templates/build-and-test-stages.yml index f1c751a..4b05121 100644 --- a/templates/build-and-test-stages.yml +++ b/templates/build-and-test-stages.yml @@ -101,13 +101,15 @@ stages: - job: ManualValidationCommentJob displayName: Manual validation (comment) steps: - - task: GitHubComment@0 + - task: GitHubAppCreateIssueComment@1 + name: CreateComment inputs: - gitHubConnection: 'github.com_tdashworth' - repositoryName: '$(RepositoryName)' - comment: | + privateKey: capgemini-microsoft-bot.private-key.pem + appId: 236185 + repo: $(Build.Repository.Name) + body: | **Manual validation requested** - Please perform any checks required on $(BuildTools.EnvironmentUrl) then approve $(BuildUrl). + Please perform any checks required on $(BuildTools.EnvironmentUrl) then approve $(BuildUrl). - job: ManualValidationJob displayName: Manual validation pool: server @@ -127,6 +129,7 @@ stages: condition: ne(dependencies.ProvisionEnvironment.outputs['ProvisionEnvironmentJob.SetEnvironmentOutputVariables.EnvironmentUrl'], '') variables: BuildTools.EnvironmentUrl: $[ stageDependencies.ProvisionEnvironment.ProvisionEnvironmentJob.outputs['SetEnvironmentOutputVariables.EnvironmentUrl'] ] + CreateComment.CommentId: $[ stageDependencies.ManualValidation.ManualValidationCommentJob.outputs['CreateComment.CommentId'] ] jobs: - job: DeleteEnvironmentJob displayName: Delete environment @@ -141,4 +144,11 @@ stages: continueOnError: true inputs: authenticationType: PowerPlatformSPN - PowerPlatformSPN: Dataverse (placeholder) \ No newline at end of file + PowerPlatformSPN: Dataverse (placeholder) + - task: GitHubAppDeleteIssueComment@1 + condition: ne(variables['CreateComment.CommentId'], '') + inputs: + privateKey: capgemini-microsoft-bot.private-key.pem + appId: 236185 + repo: $(Build.Repository.Name) + commentId: $(CreateComment.CommentId)