Skip to content

feat: pr comment generator for covector preview #191

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

Merged
merged 14 commits into from
May 5, 2021
Merged

Conversation

minkimcello
Copy link
Collaborator

@minkimcello minkimcello commented Apr 15, 2021

Motivation

To finish off the works of #179 and #187.

Approach

  • When configuring the preview workflow, user will now be required to pass in a token:
    - name: covector preview
      uses: jbolda/covector/packages/action@main
      id: covector
      with:
        command: preview
        token: ${{ secrets.MY_TOKEN }}
  • Comment contents:
    • no preview packages = Covector did not publish any preview packages
    • yes preview packages = The following preview packages have been published by Covector: ... (see real example below)
      • We should be able to get our own bot to create the comment (instead of github-action bot) if we pass in the bot's token in the workflow.
  • The covector action will rewrite its previous comment in a given PR as long as it detects that there's only one covector-generated comment. If there is none or more than one, it will create new comments instead of trying to figure out which comment to edit.
  • Added change file for action patch

TODOs

@minkimcello minkimcello force-pushed the mk/commenter branch 2 times, most recently from 1d1e108 to a759240 Compare April 16, 2021 02:30
@github-actions
Copy link
Contributor

github-actions bot commented Apr 16, 2021

The following preview packages have been published by Covector:

dc1f894

Repository owner deleted a comment from github-actions bot Apr 16, 2021
Repository owner deleted a comment from github-actions bot Apr 16, 2021
@minkimcello minkimcello force-pushed the mk/commenter branch 2 times, most recently from 3bc4036 to 61d36d1 Compare April 16, 2021 18:45
@minkimcello minkimcello changed the title [WIP] GitHub PR Comment Generator feat: pr comment generator for covector preview Apr 16, 2021
@minkimcello minkimcello marked this pull request as ready for review April 16, 2021 19:22
@minkimcello minkimcello requested a review from jbolda April 19, 2021 14:01
@jbolda
Copy link
Owner

jbolda commented Apr 19, 2021

Typescript could use some work...

I know that feeling 😄

It's already been mentioned in #187 but the boolean that determines if a package has been published or not is never toggled (I think it's just one of those things that's been overlooked). Covector will rely on this boolean for generating its PR comments.

Oh I like that thought. Perhaps we should address this issue in this PR? We will likely want to add some tests around it to confirm that we are actually returning properly. Particularly in case something inside covector changes, we don't accidentally break comments. We could probably mock out the comment generation much like I mocked out the Github Release to confirm that our inputs are indeed correct.

See example of comment template down below. We could fancy it up with a table if you'd like. I like having it as one string so it's easier to copy and paste to the terminal.

I think I agree with all of this. Perhaps we decide to adjust in the future, but I think this is a great as is.

@minkimcello minkimcello force-pushed the mk/run-preview branch 2 times, most recently from aa35df9 to 33edeac Compare April 20, 2021 18:11
@jbolda
Copy link
Owner

jbolda commented Apr 20, 2021

One question that I thought of this morning... Should we update / keep the first comment up to date with the released version? I think you haven't, and I also feel like the answer should be "no". However, I just wanted to explicitly rule it out if you agree.

@minkimcello
Copy link
Collaborator Author

Should we update / keep the first comment up to date with the released version?

What do you mean?

@jbolda
Copy link
Owner

jbolda commented Apr 27, 2021

Should we update / keep the first comment up to date with the released version?

What do you mean?

The bot could create a message initially, and after each commit edit and update the first message with the newly published packages. As opposed to adding a new comment every time a new publish happens.

@minkimcello
Copy link
Collaborator Author

Should we update / keep the first comment up to date with the released version?

What do you mean?

The bot could create a message initially, and after each commit edit and update the first message with the newly published packages. As opposed to adding a new comment every time a new publish happens.

Oh yeah it does that right now. I tag the covector-generated comment with a hidden <!--covector--> (or something like that). So each time it'll check to see if this comment exists, if so, edit that comment, if not, create a new comment.

@jbolda
Copy link
Owner

jbolda commented Apr 27, 2021

Oh cool perfect 👍

Copy link
Owner

@jbolda jbolda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers! Feel free to merge this after we get #187 merged in.

Base automatically changed from mk/run-preview to main May 5, 2021 18:19
@minkimcello minkimcello merged commit b528f44 into main May 5, 2021
@minkimcello minkimcello deleted the mk/commenter branch May 5, 2021 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants