actions
actions copied to clipboard
feat: Add optional project_name to action
This PR adds a new optional property called project_name
, so that the comments created by the Github action are unique, based on current stack_infra
+ project_name
. This will facilitate working with Pulumi actions inside monorepos, so that multiple jobs are ran in a PR and each job will have its own comment, given they are for different stacks or projects.
Besides that, also added a bit more tests around the pr spec.
On another note, I went with creating project_name
as optional, not sure on what is the desired approach for this one. Also, if there's any way to find the name of the Pulumi project without the user specifying on the YML, I believe would be less intrusive (but I couldn't find by reading the project's source code a way to do so). Feedback is more than welcomed!
Fixes #563
Oh, I also wanted to say thanks for fixing up the tests too!
Hey, @miguel-botelho thank you very much for your contribution and especially for implementing this so quickly!
if there's any way to find the name of the Pulumi project without the user specifying on the YML, I believe would be less intrusive
IMO, I think we can get the project name programmatically using the Automation API. The Project Settings have a field for the project name.
For example, we import items from the Automation API here.
You should be able to get an instance of
ProjectSettings
using this method. I think this method is callable whenever, but you might want to wait until after this line so the stack is selected. Forgive me, I'm not very well-versed on the Automation API.
Hey @RobbieMcKinstry , many thanks for the help and the quick review. I ended up passing the projectName
as a property of the current Config
object, not sure if there's a better/cleaner approach, so feel free to leave your feedback on this one: https://github.com/pulumi/actions/pull/755/commits/905033c83c161c244e8f241489f19de036111ee3
Another question, how can I test this development on one of my projects?
Another question, how can I test this development on one of my projects?
I think you can refer to the public URL and commit SHA (or branch name).
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-versioned-actions
Hey @cobraz @RobbieMcKinstry 👋
Many thanks for the review and help getting this one figured out. I've made the necessary changes to retrieve the projectName
automatically and pass it down to the handlePullRequest
method. I also went ahead and compiled the project in this branch (I've already reverted it) to test it on one of our monorepos, and it looks like it's working:

Feel free to review it again and leave your feedback on this one 😄
Hey @RobbieMcKinstry , sorry for pinging you again, were you able to review this one? 🙏
Hey @RobbieMcKinstry , just rebased it with the most recent changes in master
, it's good to take a look again 👍
@miguel-botelho Would you be willing to send me an email at [email protected]? I want to send a small thank-you gift from Pulumi for your contribution.
@miguel-botelho Would you be willing to send me an email at [email protected]? I want to send a small thank-you gift from Pulumi for your contribution.
Many thanks! I'll ping you there in a few minutes. Also, I'm the one that should be thanking for guiding me during the review phase 🙇
Hah, anytime, friend!