-
Notifications
You must be signed in to change notification settings - Fork 6
chore: add workflow to preview docs PRs on Netlify #106
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
Conversation
c798b96 to
a830b94
Compare
a830b94 to
93e4060
Compare
|
I think we can't test this easily until we've merged. I did a fair bit of looking around and it looks like you just can't access Environment secrets (which we're using) if the workflow is |
lidavidm
left a comment
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.
I guess we're protected by needing approval but this is kind of a footgun with pull_request_target.
| runs-on: ubuntu-latest | ||
| environment: "deploy-to-netlify" | ||
| steps: | ||
| - uses: actions/checkout@v4 |
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.
AIUI, on a pull_request_target trigger this checks out the repository on the target branch and not the pull request (quite intentionally), so this won't do what you want.
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.
ah, okay. The docs around this use "in the context" which is a thing I don't know what it is and I couldn't tell which checkout you get.
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.
https://github.com/orgs/community/discussions/22363#discussioncomment-3236409 is probably a better summary than the docs themselves (oops)
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.
nice, thanks
|
I'm going to close this for now. The risks and complexity aren't worth the benefits. |
Creates a new workflow that publishes the docs to Netlify for PRs that touch paths related to the docs. This uses an Environment to make access of the secrets require approval by an admin. It only triggers when the PR touches mkdocs.yml or any path inside ./docs.
The reason this is being done as a workflow is because Netlify's PR deploy previews are an all-or nothing thing meaning it would create deploy preview for even non-docs PRs and also add a noisy comment about the preview. The workflow approach gives us control over which PRs we run deploy previews for at the cost of extra complexity on the setup.
Closes #62