Skip to content
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

Suggestion: PR Preview Github Action Workflows #30

Open
rbuckton opened this issue Jun 28, 2021 · 2 comments
Open

Suggestion: PR Preview Github Action Workflows #30

rbuckton opened this issue Jun 28, 2021 · 2 comments

Comments

@rbuckton
Copy link

I noticed the proposal template repo has a build.yml github action. I recently wrote something similar for https://github.com/tc39/proposal-class-static-block that might be a useful improvement:

  • build.yml:
    • Uses JamesIves/github-pages-deploy-action@4.1.4 to deploy output to the gh-pages branch
    • Excludes pr/ folder from clean deployment
  • pr.yml:
    • Uses JamesIves/github-pages-deploy-action@4.1.4 to deploy output to the gh-pages branch under pr/<number>
    • Generates a preview URL using https://tc39.es/<repository>/pr/<number>
    • Uses phulsechinmay/rewritable-pr-comment@v0.3.0 to post a comment to the PR with a link to the generated preview:
      example

By publishing to gh-pages you don't need to check in the docs folder (which can be safely added to .gitignore), which makes PR diffs easier to read.

NOTE: This does not currently do any kind of automatic pruning generated PR outputs, so that the links in a PR remain working. Pruning stale PR renders is a manual process that can be done by deleting PR-specific subfolders under the pr folder in the gh-pages branch using the GitHub UI.

@ljharb
Copy link
Member

ljharb commented Jun 28, 2021

PR diffs shouldn't be difficult to read currently, since the html file is marked as autogenerated per https://github.com/tc39/template-for-proposals/blob/main/.gitattributes#L1, so any diff is collapsed.

That said, I do like the deploy approach!

For PRs, I'm not sure about auto-deploying PRs to proposal repos, since proposal authors might not always be vigilant about keeping spam or inappropriate content out of them, and since closing a PR wouldn't automatically prune it. However, it seems like it'd be possible to add a workflow_run action that triggers on closed or merged PRs that auto-cleaned up the PR preview?

Either way, let's start with just the build.yml change for now, and we can iterate from there?

@bakkot
Copy link
Contributor

bakkot commented May 23, 2022

I'm not sure about auto-deploying PRs to proposal repos, since proposal authors might not always be vigilant about keeping spam or inappropriate content out of them

You have to manually approve jobs from first-time contributors, I think, which should basically eliminate that problem, right?

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

No branches or pull requests

3 participants