Skip to content
This repository has been archived by the owner on Oct 28, 2022. It is now read-only.

Minimize outdated deploy comments on new build #6

Closed
South-Paw opened this issue Mar 9, 2020 · 4 comments
Closed

Minimize outdated deploy comments on new build #6

South-Paw opened this issue Mar 9, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@South-Paw
Copy link
Owner

South-Paw commented Mar 9, 2020

Description

When the Github action is going to comment on a new PR, it would be nice to see it check if there are any other deploy comments for the same Netlify Site ID and if they are older than the current one the action should minimize those comments and mark them as outdated.

Notes:

  • This might require adding some hidden metadata to each comment (using HTML comment tags? <!-- -->) such as the time of build and the Netlify Site ID so that the action can compare comments easily.
  • Could probably simply use the comments time to see if it's older 😄
  • I don't think this applies to commits, only PRs
  • Github v4 API has minimizeComment
@South-Paw South-Paw added the enhancement New feature or request label Mar 9, 2020
@polarathene
Copy link

polarathene commented Apr 1, 2021

You may want to look at this Vercel action: https://github.com/marketplace/actions/vercel-action

Which checks for an existing preview deploy comment on a PR from the action, and edits it for future builds instead of adding new comments.

This also seems to be what the official netlify bot does? (I haven't confirmed if they're using an action for their preview deploy, or just default integration with netlify): facebook/docusaurus#4409 (comment)


EDIT: I'm using this action which is for Netlify, you can see how they approach the comment management here.

However, their comment isn't customizable, so I actually disabled it and use the deploy preview URL output from the action to get the same functionality with a separate action:

- uses: marocchino/sticky-pull-request-comment@v2
  with:
    header: preview
    message: |
      [Documentation preview for this PR](${{ steps.preview.outputs.deploy-url }}) is ready! :tada:

      Built with commit ${{ github.event.pull_request.head.sha }}

You may just want to take that route and advise users to add an action like that if they need more flexibility beyond whatever your action will support for comments.

@South-Paw
Copy link
Owner Author

Which checks for an existing preview deploy comment on a PR from the action, and edits it for future builds instead of adding new comments.

Goal was to hide old comments and add new ones as to retain a history of builds for a commit/pr

This also seems to be what the official netlify bot does?

This action serves a different purpose than the Netlify GitHub app - if I wanted to use the official bot I wouldn't have written an action to deploy to Netlify 😄

nwtgck/actions-netlify

Yes, it makes use of what is already noted in the issue above - ie; by adding an identifier to each comment


NB: v1.2.0 of this action added support for GitHub environments which, if used, resolves the issue of having PRs with multiple comments on it as well as providing a history of deployments for each environment via GitHub's own UI. If you want to configure this, see the action.yml here for the action inputs

@polarathene
Copy link

Comment history retains prior build history without littering comments and hiding outdated ones. I don't see how multiple comments with hiding is a better approach?

I use an action to deploy to Netlify build output from the github CI, and only for deploy previews, production deploy is to github pages. Yet having a comment similar to the netlify bot and updating that comment is what I wanted still.

I use a separate comment update action which formats the comment how I want with a link to the preview build and any other info. That action has a prop for a unique ID to associate to it, so that you can have multiple comments that are for distinctly separate things, be that more than one netlify build involved or separate services / reports, etc.

Apologies if you had meant for something else, I just noticed the issue and figured I'd mention what I'd seen elsewhere if it'd have helped :)

@South-Paw
Copy link
Owner Author

If you wanted any of these use cases as features then please realize that your first comment did not communicate that at all.

You did not ask for anything and just made "suggestions" on where to look for code or examples.

Repository owner locked as resolved and limited conversation to collaborators Apr 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants