-
Notifications
You must be signed in to change notification settings - Fork 85
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
[do not merge] Preview new headers hierarchy #1289
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jun 10, 2024
Should fix 1034. ## Investigation It seems PR previews _are_ being cleaned up correctly for _merged_ PRs; the teardown action is running, and the previews are no longer accessible after merging (see following screenshot as example). <img width="300" alt="Screenshot 2024-06-07 at 13 35 48" src="https://github.com/Qiskit/documentation/assets/36071638/0066b309-9432-4213-81bd-1836521a8900"> It seems the problem is if a PR is closed but not merged (e.g. #1468, #1380, and #1289 still have active previews). I believe this is the reason: https://github.com/orgs/community/discussions/26657#discussioncomment-3252753. ## Solution This PR tries to fix this by using the `pull_request_target` event to trigger teardowns. This should trigger correctly when PRs are closed. We need to be careful with this event as it allows untrusted PRs to trigger events using secrets. Since this action runs on the target branch (rather than a merge commit of the target and PR branches), an untrusted user shouldn't be able to do anything malicious, but we need to make sure we **never** checkout the PR branch with this event type, or read any user-defined inputs (such as the PR title) as it could lead to an injection. I think this is unlikely, but I've left a warning in the action just in case. See frankharkins#7 for a demonstration. The "Preview teardown" step ran after the PR was closed.
Reopening so we can close and trigger teardown |
frankharkins
added a commit
to frankharkins/documentation
that referenced
this pull request
Jul 22, 2024
Should fix 1034. ## Investigation It seems PR previews _are_ being cleaned up correctly for _merged_ PRs; the teardown action is running, and the previews are no longer accessible after merging (see following screenshot as example). <img width="300" alt="Screenshot 2024-06-07 at 13 35 48" src="https://github.com/Qiskit/documentation/assets/36071638/0066b309-9432-4213-81bd-1836521a8900"> It seems the problem is if a PR is closed but not merged (e.g. Qiskit#1468, Qiskit#1380, and Qiskit#1289 still have active previews). I believe this is the reason: https://github.com/orgs/community/discussions/26657#discussioncomment-3252753. ## Solution This PR tries to fix this by using the `pull_request_target` event to trigger teardowns. This should trigger correctly when PRs are closed. We need to be careful with this event as it allows untrusted PRs to trigger events using secrets. Since this action runs on the target branch (rather than a merge commit of the target and PR branches), an untrusted user shouldn't be able to do anything malicious, but we need to make sure we **never** checkout the PR branch with this event type, or read any user-defined inputs (such as the PR title) as it could lead to an injection. I think this is unlikely, but I've left a warning in the action just in case. See #7 for a demonstration. The "Preview teardown" step ran after the PR was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Do not merge
This PR is to trigger the preview of the new header hierarchy and make the review of #1283 easy