Skip to content

Conversation

0tuedon
Copy link
Member

@0tuedon 0tuedon commented Aug 14, 2025

From this comment it turns out our current setup from PR #590 doesn't work for fork PR, the reason might be because fork PRs don't directly have access to secrets here.

So this PR triggers the pull_request_target when an admin or collaborator has /build-preview in their comment, this will give access to the secrets when the workflow runs

I also had a test here 0tuedon#2

@0tuedon 0tuedon requested review from satsie and kouloumos August 14, 2025 16:10
@0tuedon
Copy link
Member Author

0tuedon commented Aug 16, 2025

Also a test here from @jrakibi shows that it's able to still generate a preview for PR from a fork Repo

Copy link
Member

@kouloumos kouloumos left a comment

Choose a reason for hiding this comment

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

I have concerns about the added step required for this preview. I believe GitHub Actions can be configured to run on PRs from new contributors across different repositories without this workaround.

Could you please investigate alternative implementation approaches, such as using a GitHub App? Let's confirm if this extra step is the only way to achieve the desired preview functionality.

@0tuedon
Copy link
Member Author

0tuedon commented Aug 18, 2025

I have concerns about the added step required for this preview. I believe GitHub Actions can be configured to run on PRs from new contributors across different repositories without this workaround.

Could you please investigate alternative implementation approaches, such as using a GitHub App? Let's confirm if this extra step is the only way to achieve the desired preview functionality.

I think I misinterpreted it in my comment "So this PR triggers the pull_request_target when an admin or collaborator has /build-preview in their comment". here is what happens with this new workflow

  1. When a contributor creates a PR from a Fork repo it shows the image below in the PR,
Screenshot 2025-08-18 at 14 18 49
  1. Now when a maintainer or an admin approves the workflow, the workflow then has access to the secrets which is needed to make a build preview of what change in the PR

  2. if changes are made, the maintainer doesn't need to go and rerun the workflow from the actions tab, they can easily trigger it with "/build-preview" command.

An example for you to see is in bitcointranscripts/demo-test-transcript#2 in this case i only approved the workflow to run and no build-preview comment

In this other example bitcointranscripts/demo-test-transcript#1 I had to comment /build-preview because the earlier workflow failed.

So in conclusion it is not really an extra step.

@0tuedon 0tuedon requested review from kouloumos August 18, 2025 13:41
@kouloumos
Copy link
Member

Thanks for clarifying @0tuedon! I have two follow-up questions:

  1. If a contributor updates their PR (e.g. edits the submission content), does the workflow run automatically and generate an updated preview?
  2. From the screenshot below, am I correct in understanding that this manual approval is only required for first-time contributors?
image

@0tuedon
Copy link
Member Author

0tuedon commented Aug 18, 2025

Thanks for clarifying @0tuedon! I have two follow-up questions:

  1. If a contributor updates their PR (e.g. edits the submission content), does the workflow run automatically and generate an updated preview?
  2. From the screenshot below, am I correct in understanding that this manual approval is only required for first-time contributors?
  1. If a first time contributor updates their PR one would still need to approve a workflow or put a /build-preview. now if they are not a first-time contributor it would not require any of this approval.

  2. yes it is only required for first time contributor, a non first time contributor doesn't need approval.

An Example again is this bitcointranscripts/demo-test-transcript#2, I merged this bitcointranscripts/demo-test-transcript#1 and @jrakibi is no longer a first time contributor and no approval was needed for the updates.

@kouloumos
Copy link
Member

Got it, thanks for clarifying! One last question: is there a reason to keep the /build-preview comment logic? Since the button already covers the same use case, it feels like extra complexity we could remove.

@0tuedon
Copy link
Member Author

0tuedon commented Aug 18, 2025

Got it, thanks for clarifying! One last question: is there a reason to keep the /build-preview comment logic? Since the button already covers the same use case, it feels like extra complexity we could remove.

I agree with you, my reason for adding it was because i did think the comment was needed to trigger a rebuild and it was needed to grant access to the secrets. I will remove the if conditon and also test on the https://github.com/bitcointranscripts/demo-test-transcript repo

@0tuedon 0tuedon force-pushed the add-build-preview-trigger branch from df580af to 0d14412 Compare August 26, 2025 20:09
@0tuedon
Copy link
Member Author

0tuedon commented Aug 26, 2025

Hi @kouloumos, I have updated the requirements, please help review.

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