docs: add cleanup stage for preview deployments (gitlab)#5097
Merged
Conversation
Contributor
|
🌿 Preview your docs: https://fern-preview-devalog-gitlab-preview.docs.buildwithfern.com/learn Here are the markdown pages you've updated: |
Ryan-Amirthan
approved these changes
Apr 22, 2026
This file contains hidden or 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
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.
Summary
Updates the GitLab CI/CD guide to cover preview-link cleanup. The pipeline now deletes a merge
request's preview deployment once the MR merges into the default branch, so stale previews don't
linger.
Changes to
fern/products/docs/pages/developer-tools/gitlab.mdx:cleanup_previewstage that looks up the merged MR for the commit, extracts its sourcebranch, and runs
fern docs preview delete --id "$SOURCE_BRANCH".--id "$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" --force, soeach MR gets a stable preview URL that the cleanup step can target.
"main"branch rules with$CI_DEFAULT_BRANCHso the pipeline works for reposwhose default branch isn't
main.jqinbefore_script(needed to parse the MR lookup response) and swapsgrep -oPforgrep -oEfor portability.preview deletion on merge.
Review & Testing Checklist for Human
.gitlab-ci.ymlagainst a real GitLab project: open an MR, confirm a previewlink is posted, merge it, and confirm the
cleanup_previewjob deletes the preview.jqparse incleanup_previewhandles the "direct push tomain" casegracefully (job should exit 0, not fail).