-
Notifications
You must be signed in to change notification settings - Fork 441
feat: Add GitHub Actions workflow for Netlify preview deployments #667
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
feat: Add GitHub Actions workflow for Netlify preview deployments #667
Conversation
There was a problem hiding this 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

@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. |
2924eba to
2b393c0
Compare
|
Hi @alaahong, thanks for the feedback! TestingI'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 URLsThere are two bot comments appearing in my test PRs:
Both URLs now point to the same preview site because the workflow uses the Why Two Bot Comments?The Netlify bot appears because my test site still has Netlify's automatic GitHub integration enabled. Once the upstream
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. |
There was a problem hiding this 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
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.ymlthat automatically deploys documentation previews to Netlify when pull requests modify files in thewebsitedirectory. 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 authenticationNETLIFY_SITE_ID: The API ID of the Netlify site where previews will be deployedNote: 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