actions icon indicating copy to clipboard operation
actions copied to clipboard

Commenting on PR for multiple Pulumi projects within a repo

Open nebbles opened this issue 2 years ago • 1 comments

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

We have a single main infrastructure repo. Within it we have different subdirectories for different projects, since there are some dependencies in some cases (ex. a project with a lambda in it depends on a different project where the ECR has been created).

We run GitHub Actions to preview changes to these projects. Preview will be run on each work directory, such as ./A and ./B. Since the B project depends on A, we add that dependency to our GitHub Actions.

However since the PR comment does not distinguish between projects (such as by work-dir) then the behaviour we see is pulumi preview comments for project A, then when pulumi preview for project B comments, it overwrites the preview for A.

We of course have the workaround of disabling comment overwrites, however, this is very noisy. Taking a look at the code here, it looks like comment overwrite is based on finding a heading of the same name...

https://github.com/pulumi/actions/blob/837400fcd61f1dc80b714b0543618982657b27b9/src/libs/pr.ts#L47-L54

so a simple fix may be to simply include the working directory in the heading of the PR comment?

https://github.com/pulumi/actions/blob/837400fcd61f1dc80b714b0543618982657b27b9/src/libs/pr.ts#L18

Affected area/feature

This GH Action. PR comments.

nebbles avatar Aug 30 '22 13:08 nebbles

Just making an observation, I'm seeing a lot of users with mono-repo setups. A number of feature requests coming in here or to Pulumi/Pulumi are to add more monorepo support.

Another idea would be to include the fully qualified name in the comment:

Pulumi is operating on ${organization}/${project}/${stack}. 

...and then grepping for that unique ID when overwriting the comment. Definitely more work than @nebbles suggestion, but perhaps keeps the title cleaner for non-monorepo users.

RobbieMcKinstry avatar Aug 30 '22 15:08 RobbieMcKinstry

This hit me too and want options to post different comment when stack is same name, but project is different.

Pulumi is operating on ${organization}/${project}/${stack}.

Seems enough idea to me and is more friendly then current 🍹 preview on stack only message.

guitarrapc avatar Nov 30 '22 11:11 guitarrapc

Another idea is allow user to set Key to identify comment. So that user can use Stack or Project/Stack or any other as they want.

guitarrapc avatar Nov 30 '22 11:11 guitarrapc

This has been resolved with https://github.com/pulumi/actions/pull/755

nebbles avatar Apr 07 '23 20:04 nebbles