Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding check for no issue number #8792

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

markgov
Copy link
Contributor

@markgov markgov commented Dec 19, 2024

A reference to the issue / Description of it

we have found an issue with the new post comment feature that breaks the plan when the reusable workflow is called outside of a PR. Because there is no issue number we are seeing errors like the following

Error: Unhandled error: TypeError: Cannot read properties of undefined (reading 'number')

How does this PR fix the problem?

This PR adds in a check test to see if issue_number is blank if it is it just puts a comment in the console and skips to the end

How has this been tested?

Please describe the tests that you ran and provide instructions to reproduce.

{Please write here}

Deployment Plan / Instructions

Will this deployment impact the platform and / or services on it?

{Please write here}

Checklist (check x in [ ] of list items)

  • I have performed a self-review of my own code
  • All checks have passed
  • I have made corresponding changes to the documentation
  • Plan and discussed how it should be deployed to PROD (If needed)

Additional comments (if any)

{Please write here}

@markgov markgov requested a review from a team as a code owner December 19, 2024 10:26
Copy link
Contributor

Terraform Plan Summary

single-sign-on
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

modernisation-platform-account
Plan: 0 to add, 1 to change, 0 to destroy.

Copy link
Contributor

Terraform Plan Summary

core-vpc-preproduction
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

core-vpc-production
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

core-vpc-development
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Trivy Scan Success

Show Output ```hcl

Trivy will check the following folders:

</details> #### `Checkov Scan` Success
<details><summary>Show Output</summary>

```hcl

*****************************

Checkov will check the following folders:

CTFLint Scan Success

Show Output
*****************************

Setting default tflint config...
Running tflint --init...
Installing "terraform" plugin...
Installed "terraform" (source: github.com/terraform-linters/tflint-ruleset-terraform, version: 0.9.1)
tflint will check the following folders:

Trivy Scan Success

Show Output
*****************************

Trivy will check the following folders:

Copy link
Contributor

Terraform Plan Summary

core-security-production
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

pagerduty
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

core-logging-production
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

core-shared-services-production
Plan: 1 to add, 1 to change, 0 to destroy.

Copy link
Contributor

Terraform Plan Summary

github
Plan: 48 to add, 0 to change, 47 to destroy.

Copy link
Contributor

Terraform Plan Summary

core-network-services-production
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

github
No changes. Your infrastructure matches the configuration.

@@ -126,6 +126,10 @@ jobs:
const identifier = workflowId ? `_${workflowId}_\n` : `_${{ inputs.workflow_id }}_\n`;
const summary = `\`${{ steps.show.outputs.summary }}\``;
const issue_number = context.payload.pull_request.number;
if (!issue_number) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how this can work. You are comparing null to boolean and I cannot see the evidence of it working, as this run has a PR number.

Copy link
Contributor

Terraform Plan Summary

single-sign-on
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

modernisation-platform-account
Plan: 0 to add, 2 to change, 0 to destroy.

Copy link
Contributor

Terraform Plan Summary

pagerduty
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

core-vpc-production
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

core-vpc-preproduction
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

core-vpc-development
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

core-security-production
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Trivy Scan Success

Show Output ```hcl

Trivy will check the following folders:

</details> #### `Checkov Scan` Success
<details><summary>Show Output</summary>

```hcl

*****************************

Checkov will check the following folders:

CTFLint Scan Success

Show Output
*****************************

Setting default tflint config...
Running tflint --init...
Installing "terraform" plugin...
Installed "terraform" (source: github.com/terraform-linters/tflint-ruleset-terraform, version: 0.9.1)
tflint will check the following folders:

Trivy Scan Success

Show Output
*****************************

Trivy will check the following folders:

Copy link
Contributor

Terraform Plan Summary

core-logging-production
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

core-network-services-production
No changes. Your infrastructure matches the configuration.

Copy link
Contributor

Terraform Plan Summary

core-shared-services-production
Plan: 1 to add, 1 to change, 0 to destroy.

Copy link
Contributor

Terraform Plan Summary

github
No changes. Your infrastructure matches the configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants