8000 Possible to support multiple comments on a PR? · Issue #96 · rossjrw/pr-preview-action · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Possible to support multiple comments on a PR? #96

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

Closed
luke-denton-ofx opened this issue Jan 7, 2025 · 4 comments · Fixed by #97
Closed

Possible to support multiple comments on a PR? #96

luke-denton-ofx opened this issue Jan 7, 2025 · 4 comments · Fixed by #97
Labels
enhancement New feature or request

Comments

@luke-denton-ofx
Copy link

The sticky-pull-request-comment action supports multiple comments on a single PR through the use of the header property.

Is it possible to expose that functionality through pr-preview-action?

@rossjrw
Copy link
Owner
rossjrw commented Jan 8, 2025

The action sets header to a hardcoded value of pr-preview, so presumably it is not affecting unrelated sticky comments on the same PR (I hope!)

Could you share a use case for this?

@luke-denton-ofx
Copy link
Author

Absolutely. So I'm keen to deploy two things on each PR. Our SPA, and a Storybook instance for the code that has been changed. The reason for this is we're currently in the process of creating a new design system, so for the short term, we very likely will only have Storybook stories to review individual components.

Your action works perfectly to achieve that, the only thing that we miss out on is having both environments linked to in a comment.

This is our action that is making use of your action, and it would be great if we could pass through a custom header value, with the default being pr-preview. In the code below, I've got storybook listed first, so that its comment gets overwritten by the app preview comment, as the preview action that runs last is the one whose comment wins (bit of a mouth full 🫠).
In this context, header probably doesn't make the most sense, so I'd be more than happy for you to come up with a naming convention that does make sense

deploy-preview:
    # ...
      - name: Deploy Storybook preview
        uses: rossjrw/pr-preview-action@v1.4.7
        with:
          header: storybook-preview # desired custom value here
          source-dir: ./storybook/storybook-static/
          umbrella-dir: storybook-preview
      - name: Deploy preview
        uses: rossjrw/pr-preview-action@v1.4.7
        with:
          source-dir: ./build/

While it would be great to be able to pass options down to the underlying actions that pr-preview-actions is using, even if that's as an undocumented feature for people who "know what they're doing", in the short term, being able to control how many comments are added to a PR would be amazing

@rossjrw rossjrw added the enhancement New feature or request label Jan 9, 2025
@rossjrw
Copy link
Owner
rossjrw commented Jan 10, 2025

The default comment can now be disabled as of v1.6.0 and new output parameters can be used to construct your own comment using whatever marketplace action you like.

This isn't exactly what you were asking for, but it's more flexible - you could disable the default comment for both previews and use e.g. https://github.com/marocchino/sticky-pull-request-comment (or whatever action or homebrew script you like) to add a comment for each.

If you wanted to reproduce the default comment as of v1.6.0:

    - uses: rossjrw/pr-preview-action@v1
      id: preview-step
      with:
        comment: false

    - uses: marocchino/sticky-pull-request-comment@v2.9.0
      if: steps.preview-step.outputs.deployment_action == 'deploy' && env.deployment_status == 'success'
      with:
        header: pr-preview
        message: |
          [PR Preview Action](https://github.com/rossjrw/pr-preview-action) ${{ steps.preview-step.outputs.action-version }}
          :---:
          | <p></p> :rocket: View preview at <br> ${{ steps.preview-step.outputs.preview-url }} <br><br>
          | <h6>Built to branch [`BRANCH_NAME_HERE`](${{ github.server_url }}/${{ github.repository }}/tree/BRANCH_NAME_HERE) at ${{ steps.preview-step.outputs.action-start-time }}. <br> Preview will be ready when the [GitHub Pages deployment](${{ github.server_url }}/${{ github.repository }}/deployments) is complete. <br><br> </h6>

@luke-denton-ofx
Copy link
Author

I appreciate the configuration option! I do agree that this is a more flexible approach, and thank you for the template to follow to achieve the current action comment 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0