Skip to content

Conversation

@amoeba
Copy link
Member

@amoeba amoeba commented Sep 26, 2025

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

@amoeba amoeba temporarily deployed to deploy-to-netlify September 26, 2025 22:37 — with GitHub Actions Inactive
@amoeba amoeba temporarily deployed to deploy-to-netlify September 26, 2025 22:50 — with GitHub Actions Inactive
@amoeba amoeba changed the title draft: netlify pr deploys chore: add workflow to preview docs PRs on Netlify Sep 26, 2025
@amoeba amoeba force-pushed the netlify-pr-previews branch from c798b96 to a830b94 Compare September 26, 2025 23:02
@amoeba amoeba force-pushed the netlify-pr-previews branch from a830b94 to 93e4060 Compare September 26, 2025 23:10
@amoeba amoeba marked this pull request as ready for review September 26, 2025 23:15
@amoeba
Copy link
Member Author

amoeba commented Sep 26, 2025

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 pull_request. So I'm trying pull_request_target which should be able to access Environment secrets. But we can't test that here because GitHub doesn't run pull_request_target workflows on the PRs that add them I guess.

Copy link
Member

@lidavidm lidavidm left a 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
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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)

Copy link
Member Author

Choose a reason for hiding this comment

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

nice, thanks

@amoeba
Copy link
Member Author

amoeba commented Sep 27, 2025

I'm going to close this for now. The risks and complexity aren't worth the benefits.

@amoeba amoeba closed this Sep 27, 2025
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.

Set up PR deploy previews for docs site

2 participants