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

feat: Add PROJECT_NAME env var to custom workflow hook #4808

Conversation

philchristensen
Copy link

what

I'd like to be able to use $PROJECT_NAME in the post_workflow_hooks (and pre_workflow_hooks) configuration section. It's already available to run on custom workflows.

why

I'd like to label the PR with info about which TF project was applied.

tests

I updated the tests for these two hooks to test PROJECT_NAME, but I'm still seeing two test errors that seem unrelated in:

--- FAIL: TestRenderProjectResults (0.00s)
    logger.go:146: 2024-08-02T14:38:41.327-0400	INFO	log
    --- FAIL: TestRenderProjectResults/single_successful_policy_check_with_project_name (0.00s)
        --- FAIL: TestRenderProjectResults/single_successful_policy_check_with_project_name/single_successful_policy_check_with_project_name (0.00s)
            markdown_renderer_test.go:1192: [Ran Policy Check for project: `projectname` dir: `path` workspace: `workspace`
            ...
            ...
        --- FAIL: TestRenderProjectResults/single_successful_policy_check_with_project_name/single_successful_policy_check_with_project_name#01 (0.00s)
            markdown_renderer_test.go:1189: [Ran Policy Check for project: `projectname` dir: `path` workspace: `workspace`
            ...
            ...

If I should fix these too, I just need someone who can point in the right direction.

references

@philchristensen philchristensen requested review from a team as code owners August 2, 2024 18:48
@philchristensen philchristensen requested review from GenPage, lukemassa and X-Guardian and removed request for a team August 2, 2024 18:48
@github-actions github-actions bot added the go Pull requests that update Go code label Aug 2, 2024
@philchristensen philchristensen changed the title Add PROJECT_NAME env var to custom workflow hook feat: Add PROJECT_NAME env var to custom workflow hook Aug 2, 2024
@X-Guardian
Copy link
Contributor

@philchristensen, the pre/post workflow hooks can have a one to many relationship with projects, so I don't see how this can work.

@philchristensen
Copy link
Author

ah, yeah. I wouldn’t mind seeing this as a comma separated list of values. but i can close this for now until i can figure that out…

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants