GitHub Actions Workflow Formatter Preview

This free and online tool will format your GitHub Actions workflow file to make it more readable.

Please note that this tool is experimental and in development. It currently cannot support Yaml comments.

Formatting...

How to use

Through the web interface

To use this tool, simply paste your GitHub Actions workflow file into the text area above and click the "Format Workflow" button. The formatted workflow will be displayed in the textarea, and you can copy it to your clipboard.

You can also use the keyboard shortcut Ctrl + Enter to submit the form automatically.

The formatted workflow will be stored in your browser's local storage, so you can close the tab and come back to it later without losing your work.

If you have any feedback or suggestions, please feel free to reach out to me on Twitter.

Through the API

You can also use this tool programmatically by sending a POST request to the https://lightspeed.desilva.se/api/workflow-formatter endpoint with the workflow parameter.

The response will be a JSON object with the result key containing the formatted workflow, and some extra information.

If an error occurs, the response will contain a message key with the error message.

Example:
fetch('https://lightspeed.desilva.se/api/workflow-formatter', {
    method: 'POST',
    body: new FormData(form),
    headers: {
        'Accept': 'application/json',
    }
})
.then(response => response.json())
.then(data => {
    console.log(data.result);
});
use Illuminate\Support\Facades\Http;

$response = Http::asJson()->acceptJson()->post('https://lightspeed.desilva.se/api/workflow-formatter', [
    'workflow' => $input,
])->throw();

return $response->json();

The API is rate-limited to 60 requests per minute per IP address.

Through the command line

Coming soon!

About

What does it do?

This tool will format your GitHub Actions workflow file to make it more readable. It will:

How does it work?

This tool is built with PHP and Laravel, and works by a mixture of string operations and tokenization and reassembly using an abstract syntax tree (AST) which is further normalized and formatted to produce the final output. Since there is no official style guide for workflows, the formatting is opinionated and based on the author's preferences, and by using hints from the official documentation.

Why should I care about formatting?

Formatting your workflow file makes it easier to read and understand, and can help you spot errors and issues more easily. It also makes it easier to collaborate with others and share your workflow files. Additionally, your files will be more consistent and maintainable and look much cleaner and more professional.

Technical limitations