Skip to content

Conversation

@ongdisheng
Copy link
Contributor

@ongdisheng ongdisheng commented Oct 31, 2025

Closed: #638

Purpose of the pull request

This PR implements Netlify preview deployments for documentation changes using GitHub Actions. It addresses issue #638 by enabling automatic preview site generation when contributors submit pull requests that modify documentation files. This allows reviewers to see the rendered documentation before merging changes to the main branch.

What's changed?

This PR added a new GitHub Actions workflow file preview-docs.yml that automatically deploys documentation previews to Netlify when pull requests modify files in the website directory. The workflow uses the actions-netlify to handle the deployment and automatically posts the preview URL as a comment on the pull request. It only triggers for pull requests that contain changes to the documentation, ensuring that code-only pull requests do not consume build resources unnecessarily. This implementation requires creating a Netlify site first by importing the project from Netlify dashboard. Once the site is created, there are two repository secrets that need to be configured in the repository settings:

  • NETLIFY_AUTH_TOKEN: A personal access token from Netlify for authentication
  • NETLIFY_SITE_ID: The API ID of the Netlify site where previews will be deployed

Note: A working demonstration of this workflow can be seen in this test PR on my fork, where the GitHub Actions bot successfully posted the preview URL.

Checklist

  • I have read the Contributor Guide.
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

@delei delei requested a review from alaahong October 31, 2025 08:26
Copy link
Member

@alaahong alaahong left a comment

Choose a reason for hiding this comment

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

Seems it only working while website folder changes, it's well to limited the deploy on NETLIFY.

And meanwhile, as Fesod doesn't have NETLIFY token at this moment, had you validated on your resource before raise the PR?
The given deployed sample is broken as below screenshot
image

@delei do you have any suggestion on the deployment target as FESOD also register one account for this too?

@delei
Copy link
Member

delei commented Oct 31, 2025

@delei do you have any suggestion on the deployment target as FESOD also register one account for this too?

I agree to register and use NETLIFY.

@ongdisheng ongdisheng force-pushed the feat/add-netlify-preview-workflow branch from 2924eba to 2b393c0 Compare October 31, 2025 19:27
@ongdisheng
Copy link
Contributor Author

ongdisheng commented Oct 31, 2025

Hi @alaahong, thanks for the feedback!

Testing

I've tested the workflow on my fork with the required secrets configured. You can see the working implementation in this test PR.

About the Deployment URLs

There are two bot comments appearing in my test PRs:

  • GitHub Actions bot: This is the deployment from the workflow
  • Netlify bot: This is from Netlify's automatic GitHub integration

Both URLs now point to the same preview site because the workflow uses the alias parameter to standardize the URL format. However, only the GitHub Actions workflow deployment is needed.

Why Two Bot Comments?

The Netlify bot appears because my test site still has Netlify's automatic GitHub integration enabled. Once the upstream fesod repository is configured, you can disable Netlify's automatic builds by setting:

  • Site configuration → Build & deploy → Deploy Previews → None
  • Site configuration → Build & deploy → Branch deploys → None

This way, only the GitHub Actions workflow will build and deploy, posting a single bot comment with the preview URL. This prevents duplicate builds and saves Netlify build minutes. The workflow has been tested and is working correctly on my fork.

@delei delei added the PR: first-time contributor first-time contributor label Nov 1, 2025
Copy link
Member

@alaahong alaahong left a comment

Choose a reason for hiding this comment

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

LGTM

It's a great enhancement for docs preview

@delei delei merged commit cb6b107 into apache:main Nov 2, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: first-time contributor first-time contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] Document PR should be deployed on temporary website for preview

3 participants