From 0580abffda90139cd65c684de4055950a99efbb1 Mon Sep 17 00:00:00 2001 From: Admiral Date: Tue, 2 Apr 2024 09:47:16 +0200 Subject: [PATCH] Update ci.yml --- .github/workflows/ci.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e5695c..7734905 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: Terraform Cloud on: push: - branches: [ main ] + branches: [main] pull_request: env: @@ -57,13 +57,17 @@ jobs: \`\`\`\n\n\`\`\` *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; - - await github.rest.issues.createComment({ - issue_number: context.payload.pull_request.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: output - }); + + if (context.payload.pull_request) { + await github.rest.issues.createComment({ + issue_number: context.payload.pull_request.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: output + }); + } else { + console.log('No pull request context found.'); + } - name: Terraform Plan Status if: steps.plan.outcome == 'failure'