Skip to content

Conversation

@mgajek-cern
Copy link

@mgajek-cern mgajek-cern commented Dec 1, 2025

Addresses #658


Some additional information:

Testing & Verification

Fork-to-Fork Testing

To verify the pull_request_target workflow with fork PRs, we conducted the following experiment:

  1. Setup fork chain:

    • Merged preview workflow into mgajek-cern/documentation main branch (required for pull_request_target to run)
    • Created fork: MGTheTrain/documentation synced with mgajek-cern/documentation
    • Created 3 test branches in MGTheTrain/documentation to verify workflow behavior
  2. Verified deployment functionality:

    • Opened PRs from MGTheTrain/documentationmgajek-cern/documentation
    • Confirmed workflow creates preview deployments with sticky comments:
     🚀 Preview Deployed
     Preview URL: https://mgajek-cern.github.io/documentation/pr-preview/pr-6/
     Built from commit: d17cf2c
  1. Verified cleanup functionality:

Next Steps

  1. Merge this PR into upstream rucio/documentation
  2. Verify identical behavior with actual fork PRs from contributors
  3. If permission issues arise (unlikely, as PAT is from org member mgajek-cern), consider using service account PAT

Note: The PREVIEW_TOKEN PAT has full repo and workflow permissions and is created by an org member, so cross-fork deployment should work as demonstrated. PREVIEW_TOKEN is configured as a GitHub secret: https://github.com/rucio/documentation/settings/secrets/actions

@mgajek-cern mgajek-cern marked this pull request as draft December 1, 2025 14:51
@mgajek-cern mgajek-cern force-pushed the patch-658-pr-preview-deployment-for-doc branch 21 times, most recently from edb31ef to 18b8cc9 Compare December 3, 2025 12:18
- Adds PR preview deployment for fork PRs using pull_request_target
- Uses JamesIves/github-pages-deploy-action for cross-repo deployment
- Implements automatic cleanup when PRs close
- Adds sticky PR comments with preview URLs
- Includes scheduled cleanup for stale/orphaned previews
- Extracts build logic to reusable workflow with dynamic baseUrl
- Configures Docusaurus baseUrl dynamically for PR preview paths
- Preserves PR preview directory during main docs deployment

Ref rucio#658
@mgajek-cern mgajek-cern force-pushed the patch-658-pr-preview-deployment-for-doc branch from 18b8cc9 to b543465 Compare December 3, 2025 12:20
@mgajek-cern mgajek-cern changed the title enhancement(CI): Add PR preview deployment with reusable workflow feat(ci): add PR preview deployment workflow Dec 3, 2025
@mgajek-cern mgajek-cern marked this pull request as ready for review December 3, 2025 13:05
@voetberg
Copy link
Contributor

voetberg commented Dec 4, 2025

Does this use your own account to post the sticky comments? Maybe a link included in the CI would be cleaner. I don't love the idea of the action using your account to make comments on your behalf.

@mgajek-cern
Copy link
Author

mgajek-cern commented Dec 5, 2025

Does this use your own account to post the sticky comments? Maybe a link included in the CI would be cleaner. I don't love the idea of the action using your account to make comments on your behalf.

Good point about the account visibility. Ideally, we'll replace the current PREVIEW_TOKEN (which uses my personal PAT) with a PAT from a Rucio organization service account for the rucio/documentation repo, assuming one exists with the necessary permissions.

About the CI link: Since the sticky comment already displays the preview URL directly in the PR (where developers typically check first), including it in the CI logs feels unnecessary. That said, if you'd prefer having it in the CI output too (using an echo statement or similar) for quick access from the Actions tab, I'll add that. Just let me know if you want it in both places.

@voetberg
Copy link
Contributor

voetberg commented Dec 5, 2025

Does this use your own account to post the sticky comments? Maybe a link included in the CI would be cleaner. I don't love the idea of the action using your account to make comments on your behalf.

Good point about the account visibility. Ideally, we'll replace the current PREVIEW_TOKEN (which uses my personal PAT) with a PAT from a Rucio organization service account for the rucio/documentation repo, assuming one exists with the necessary permissions.

About the CI link: Since the sticky comment already displays the preview URL directly in the PR (where developers typically check first), including it in the CI logs feels unnecessary. That said, if you'd prefer having it in the CI output too (using an echo statement or similar) for quick access from the Actions tab, I'll add that. Just let me know if you want it in both places.

Sorry for the lack of clarity there, I meant either-or. If we have a service account post it instead that would be fine!

@mgajek-cern
Copy link
Author

mgajek-cern commented Dec 5, 2025

Sorry for the lack of clarity there, I meant either-or. If we have a service account post it instead that would be fine!

Perfect, thanks for clarifying. I couldn't find an existing service account. I'll ask if we should create one (e.g. rucio-bot or rucio-ci) and request the organization admins to set it up.

If that's not feasible, we could fall back to showing the preview URL only in CI logs (as you suggested) instead of PR comments. That would avoid the personal account issue, though it's less visible and requires extra clicks to access compared to sticky comments in the PR.

@mgajek-cern
Copy link
Author

Sorry for the lack of clarity there, I meant either-or. If we have a service account post it instead that would be fine!

Perfect, thanks for clarifying. I couldn't find an existing service account. I'll ask if we should create one (e.g. rucio-bot or rucio-ci) and request the organization admins to set it up.

If that's not feasible, we could fall back to showing the preview URL only in CI logs (as you suggested) instead of PR comments. That would avoid the personal account issue, though it's less visible and requires extra clicks to access compared to sticky comments in the PR.

@bari12: Should we create a service account (e.g. rucio-bot or rucio-ci) for this or fall back to showing the preview URL only in the CI logs? If we go with a service account, who could set it up?

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