diff --git a/.github/workflows/reusable_terraform_plan_apply.yml b/.github/workflows/reusable_terraform_plan_apply.yml index 7e5a4191f..7cc46160d 100644 --- a/.github/workflows/reusable_terraform_plan_apply.yml +++ b/.github/workflows/reusable_terraform_plan_apply.yml @@ -125,7 +125,11 @@ jobs: const workflowId = "${{ env.WORKSPACE_NAME }}"; const identifier = workflowId ? `_${workflowId}_\n` : `_${{ inputs.workflow_id }}_\n`; const summary = `\`${{ steps.show.outputs.summary }}\``; - const issue_number = context.payload.pull_request.number; + const issue_number = context.payload.pull_request ? context.payload.pull_request.number : null; + if (!issue_number) { + console.log('No issue number found, skipping comment.'); + return; + } await github.rest.issues.createComment({ ...context.repo, issue_number,