Publish HTML Content via GitHub Gist and Generate Shareable Preview - n8n Workflow

Use this robust n8n workflow to automatically publish generated HTML content as a GitHub Gist and retrieve a direct, previewable URL using the htmlpreview service. Perfect for report sharing.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Developers and engineers who generate technical reports (e.g., test results, linting reports) as HTML.

  • Users building composite n8n workflows that need a public hosting solution for temporary file sharing.

  • Automation specialists looking for reusable n8n templates for API interactions with GitHub.

  • Teams needing a quick, reliable way to share visualized data generated within an n8n environment.

Overview

This specialized n8n workflow solves the common problem of sharing dynamic HTML content generated during an automation run. Instead of requiring access to a dedicated web server, this solution leverages GitHub Gist as a secure, temporary storage location. By using the When Executed by Another Workflow n8n trigger, this component acts as a highly effective utility. When executed, it receives raw HTML content, calls the GitHub API to create a new Gist (effectively hosting the file), and then uses the file's raw URL combined with the htmlpreview.github.io service to generate a live, rendered preview URL. This reusable n8n node combination is ideal for simplifying report distribution and integrating seamlessly into larger n8n automation pipelines. The efficiency of this n8n workflow makes distributing complex, generated data straightforward.

How it Works

This powerful n8n workflow operates as a callable sub-routine, designed to be executed by a parent workflow.


  1. Trigger Input: The process begins with the When Executed by Another Workflow n8n trigger, which listens for incoming execution calls and expects the raw HTML content to be passed in via a variable named html.

  2. Gist Creation: The subsequent n8n node, labeled 'Create Gist', executes an HTTP request (POST) to the GitHub Gist API. It uses the received html data to populate the content of a file named report.html within the new, private Gist. Authentication is managed via a dedicated GitHub API credential.

  3. URL Generation: After the GitHub API returns the Gist creation confirmation, the 'Set URL' n8n node processes the output. It extracts the raw_url of the newly created file and strategically prepends the URL with https://htmlpreview.github.io/? to create a direct link that automatically renders the HTML content, providing a polished preview URL.

  4. Output: The final output of this n8n workflow is the generated shareable URL, which the calling parent workflow can then use for notifications or logging.

Installation Guide

To install and utilize this n8n template, follow these steps:


  1. Import the Workflow: Copy the provided JSON data and paste it directly into your n8n instance's workflow editor using the 'Import from JSON' option.

  2. Configure GitHub Credentials: Locate the 'Create Gist' n8n node. You must set up a GitHub HTTP Header Auth credential. This typically requires a GitHub Personal Access Token (PAT) with gist scope permissions.

  3. Set Credential: In the 'Create Gist' n8n node, ensure the 'Credentials' section is correctly linked to your newly configured GitHub API credential.

  4. Integration: Since this uses the 'When Executed by Another Workflow' n8n trigger, you must call it from a primary workflow, ensuring you pass the generated HTML content into the input field named html when executing this sub-workflow.

Node Details


  • When Executed by Another Workflow (n8n trigger): This specific n8n trigger allows the workflow to function as a modular unit or utility. It is configured to accept a single input field named html, which carries the raw HTML document content.

  • Create Gist (n8n node - HTTP Request): This is the core action n8n node. It communicates directly with the GitHub API to publish the content. Key configuration includes using the POST method, setting the URL to https://api.github.com/gists, and defining the JSON body to include the input HTML data within a file named report.html. It uses generic HTTP authentication.

  • Set URL (n8n node - Set): A critical data manipulation n8n node. It calculates and sets the final output variable URL. The value uses an expression to combine the static URL preview service (htmlpreview.github.io) with the dynamic raw_url returned from the GitHub Gist creation step, ensuring a publicly viewable, rendered HTML result.

Related n8n Workflows

Free

Nodes: 4 Nodes
Updated: December 26 2025
View all
Created by

Open Paws is a nonprofit building open-source AI tools to accelerate animal advocacy. We create machine learning models and automation workflows trained on real-world campaign data to help end industrial animal exploitation. All tools are free, transparent, and designed for real-world impact.

Featured*