Skip to content
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

feat: Add tweet preview and tweeted URL to PR conversation #225

Closed

Conversation

IstoraMandiri
Copy link
Contributor

@IstoraMandiri IstoraMandiri commented Oct 5, 2022

Fixes #223

After each PR preview generation, the bot will post a comment to the PR thread, making things far more obvious for contributors and maintainers.

Example: IstoraMandiri/twitter-together-testing#18

EDIT: In draft mode until I implement post-merge URL tweeting and remote fork PRs.

TODO: Document updating workflow, gituhb for "Actions permissions", splitting workflow into two files

@IstoraMandiri IstoraMandiri marked this pull request as ready for review October 5, 2022 09:27
@IstoraMandiri IstoraMandiri marked this pull request as draft October 5, 2022 09:35
@IstoraMandiri IstoraMandiri marked this pull request as ready for review October 5, 2022 09:43
@IstoraMandiri IstoraMandiri changed the title feat: Add tweet preview to PR conversation feat: Add tweet preview and tweeted URL to PR conversation Oct 5, 2022
@IstoraMandiri IstoraMandiri marked this pull request as draft October 5, 2022 09:44
@IstoraMandiri
Copy link
Contributor Author

IstoraMandiri commented Oct 5, 2022

@gr2m Perhaps you can point me in the right direction with the post-merge part of this PR with your better knowledge of github actions and octokit.

Currently the push action will add a comment of the tweeted URL to the commit itself, but this is not very visible and I would like to have it also post a link to the published tweet in the conversation thread of the merged PR.

The problem is that within the push action, I cannot find a reference to the pull request number anywhere in the GITHUB_EVENT_PATH payload. Is there some other way to get a reference to the PR that triggered the push action so I can then post in that thread?

Thanks.

@IstoraMandiri
Copy link
Contributor Author

Another problem I've run into is that the pull_request action does not have permissions to post a comment if the PR is coming from a forked repo.

I think we'd somehow need to use pull_request_target, or otherwise grant permissions. Any suggestions @gr2m ?

@gr2m
Copy link
Contributor

gr2m commented Oct 13, 2022

I think we'd somehow need to use pull_request_target

That is true. When using Actions, that's what we need to do. We could support both and tell if folks are uncomfortable to use the pull_request_target trigger, they can use pull_request but won't get comment previews. We can also narrow down the permission of the passed GITHUB_TOKEN to only what we need.

I think we'll need to update action code to account for the event trigger change

@IstoraMandiri
Copy link
Contributor Author

I'm closing this PR and integrating it into #224

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.

Include action result messages in Pull Request conversation thread.
2 participants