Skip to content

yKicchan/generate-directory-listing-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Language: 🇺🇸 🇯🇵

GitHub Release license CI Deploy Coverage

Generate Directory Listing Action

This Action generates an index.html that can explore the specified directory.
It is useful for viewing static pages, such as those published on GitHub Pages.

Demo

Here is a preview of the index.html generated using this Action.
For religious reasons, it also supports Dark mode.

Light Theme Dark Theme
Light Theme Demo Dark Theme Demo

The actual demo page generated with this Action is available on GitHub Pages:
https://ykicchan.github.io/generate-directory-listing-action/

Usage

The simplest way to use this Action is to invoke it and specify the target directory.

- name: Generate Directory listing
  uses: yKicchan/generate-directory-listing-action@v1
  with:
    target: dist

Specifying the Version

This Action follows semantic versioning.
From a security perspective, pinning the version using a commit hash is highly recommended.
If you want to receive updates, you can specify either the major or minor version.

# Fully pin the version to avoid updates
uses: yKicchan/generate-directory-listing-action@COMMIT_SHA
uses: yKicchan/[email protected]

# Pin the minor version to receive patch updates only
uses: yKicchan/[email protected]

# Pin the major version to receive compatible updates
uses: yKicchan/generate-directory-listing-action@v1

Exclude Specific Files

By using the ignore option, you can exclude files that match specific patterns.

Tip

To specify multiple patterns, separate them with commas.

- name: Generate Directory listing
  uses: yKicchan/generate-directory-listing-action@v1
  with:
    target: dist
    ignore: "**/*.map"

Changing the Display Format

You can change the display format using the viewType option. Currently, table and list are available, with the default being table. Below is an example of the list display.

- name: Generate Directory listing
  uses: yKicchan/generate-directory-listing-action@v1
  with:
    target: dist
    viewType: "list"
Light Theme Dark Theme
light dark

Customize Appearance

You can load additional CSS to customize the appearance of the generated index.html.

Warning

To ensure your customizations are applied correctly, please pin the version completely.
Example: uses: yKicchan/[email protected]
The HTML structure may change with version updates.

- name: Generate Directory listing
  uses: yKicchan/generate-directory-listing-action@v1
  with:
    target: dist
    # Specify the path relative to the target directory
    theme: "./custom.css"

Options

Customizable options are available for flexibility.
For detailed specifications, check action.yml.

Key Type Required Default Value Description
target string yes - The target directory to make browsable
viewType string no "table" Specifies the display format.
Currently, table and list are available options.
ignore string no - Glob patterns to exclude from the search. Multiple patterns can be specified using commas.
showHiddenFiles boolean no false Whether to display hidden files
theme string no - CSS styles to enhance the generated index.html. Specify the path relative to the target directory.
override boolean no false Whether to overwrite an existing index.html