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

allowing job url in template #5392

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

Conversation

cpaloia
Copy link

@cpaloia cpaloia commented Mar 7, 2025

What

This PR adds support for including the job URL in the GitHub comment template.

Why

In certain cases, it's necessary to hide Terraform plan output in GitHub comments—such as in public repositories where the output may contain sensitive information. However, users may still need access to the plan details via a secure URL, such as one behind a firewall or ingress.

By including the job URL in the GitHub comment template (in addition to the existing GitHub check link), we provide users with clear guidance on why the output is hidden and where they can access it instead.

Tests

Tested locally by overriding the comment template and verifying the job URL was correctly included.

References

Notes

  • I encountered issues running pegomock unless I downgraded Go to 1.23.0 in go.mod.
  • Currently, the job URL is added only to plan success—I considered adding it to PolicyCheckResults, but I’m unsure whether those results are accessible via a URL. Would appreciate any feedback on this!

@cpaloia cpaloia requested review from a team as code owners March 7, 2025 12:14
@cpaloia cpaloia requested review from GenPage, lukemassa and X-Guardian and removed request for a team March 7, 2025 12:14
@dosubot dosubot bot added feature New functionality/enhancement go Pull requests that update Go code labels Mar 7, 2025
@github-actions github-actions bot removed the feature New functionality/enhancement label Mar 7, 2025
@jamengual
Copy link
Contributor

I do not think policy checks have a URL status at all.

Copy link
Contributor

@X-Guardian X-Guardian left a comment

Choose a reason for hiding this comment

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

Can you update the PR title and description to detail what this PR is actually doing, i.e. adding the job URL to the plan success model which can then be used by a custom plan success template. Also please detail the changes you have made to LockURLGenerator and why.

It also needs markdown_renderer_test updating with tests for this change.

@@ -35,3 +35,6 @@ tmp-CHANGELOG.md

# playwright
test-results/

Copy link
Contributor

Choose a reason for hiding this comment

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

Please revert this irrelevant .gitignore change


// LockURLGenerator generates urls to locks.
type LockURLGenerator interface {
// URLGenerator generates urls.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// URLGenerator generates urls.
// URLGenerator generates lock and project urls.

// GenerateLockURL returns the full URL to the lock at lockID.
GenerateLockURL(lockID string) string
GenerateProjectJobURL(ctx command.ProjectContext) (string, error)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a godoc comment for this

@X-Guardian X-Guardian added the waiting-on-response Waiting for a response from the user label Mar 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code waiting-on-response Waiting for a response from the user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants