Skip to content

PRs: Add preview workflow using GitHub Actions - #908

Draft
Venefilyn wants to merge 1 commit into
cockpit-project:mainfrom
Venefilyn:pr/preview-github-actions
Draft

PRs: Add preview workflow using GitHub Actions#908
Venefilyn wants to merge 1 commit into
cockpit-project:mainfrom
Venefilyn:pr/preview-github-actions

Conversation

@Venefilyn

Copy link
Copy Markdown
Member

Adds a PR preview workflows that

  • Create a build from PR itself without secrets
  • Publishes build artifact to preview PR subdirectory in gh-pages branch
  • Removes preview PR subdirectory from gh-pages branch

Reason for a split between build and publish has to do with a workaround
for security where workflows that are triggered on a pull request cannot
access secrets. As the deploy workflow just publishes an artifact it can
have access to secrets. Note this only has to do with PRs from forks and
does not matter for PRs within the repo itself.

PR deployment and PR teardowns are run from the base repository and is
therefore secure.

Build workflows will need to be manually approved from outside
contributors. They will only be deployed if build workflow has
succeeded.

Upon PR preview being created a comment will be added to the PR itself
with a link to the preview URL. If this PR is run against our main we
will publish the preview under <cockpit-project.org/preview-pr/> and if
the PR is run against a fork it will publish the preview under
<username.github.io/cockpit-project.github.io/preview-pr/>. If the user
has a custom domain for their <username.github.io> the links will still
work but just be redirected by GitHub.

Adds a PR preview workflows that
- Create a build from PR itself without secrets
- Publishes build artifact to preview PR subdirectory in gh-pages branch
- Removes preview PR subdirectory from gh-pages branch

Reason for a split between build and publish has to do with a workaround
for security where workflows that are triggered on a pull request cannot
access secrets. As the deploy workflow just publishes an artifact it can
have access to secrets. Note this only has to do with PRs from forks and
does not matter for PRs within the repo itself.

PR deployment and PR teardowns are run from the base repository and is
therefore secure.

Build workflows will need to be manually approved from outside
contributors. They will only be deployed if build workflow has
succeeded.

Upon PR preview being created a comment will be added to the PR itself
with a link to the preview URL. If this PR is run against our main we
will publish the preview under <cockpit-project.org/preview-pr/> and if
the PR is run against a fork it will publish the preview under
<username.github.io/cockpit-project.github.io/preview-pr/>. If the user
has a custom domain for their <username.github.io> the links will still
work but just be redirected by GitHub.

Signed-off-by: Freya Gustavsson <freya@venefilyn.se>
@Venefilyn

Venefilyn commented Jun 30, 2026

Copy link
Copy Markdown
Member Author

@allisonkarlitskaya Here it is.

This likely breaks deployment currently. I think we'd have to get rid of the GitHub build and deploy workflow altogether cause I'm running into this issue. If merged this would break URLs completely in its current state

The thing with the GitHub workflow is also that it is extremely outdated, we're talking years old with no update on the workflow as well as a lot of the plugins

@Venefilyn Venefilyn changed the title PRs: Add preview workflow PRs: Add preview workflow using GitHub Actions Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant