English | 日本語
Automatically format YAML files using yamlfmt
in your GitHub Actions workflows. This action helps maintain consistent code style, making reviews and debugging easier.
name: YAML Formatting
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: yamllint
uses: reviewdog/action-yamllint@v1
with:
github_token: ${{ secrets.github_token }}
fail_on_error: true
- name: yamlfmt
uses: yk-lab/yamlfmt-action@v1
- Automatic Formatting: Uses
yamlfmt
to standardize the formatting of YAML files. - Easy Integration: Add a few lines to your existing workflows to get started.
- Customizable Options: Configure
yamlfmt
options to suit your project's needs. - Fast and Lightweight: Designed for speed and efficiency.
Add yk-lab/yamlfmt-action
as a step in your workflow:
name: YAML Formatting
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run yamlfmt
uses: yk-lab/yamlfmt-action@v1
The action supports the following input parameters:
version
: Version ofyamlfmt
to use (default:latest
, e.g.,v0.13.0
)path
: Path to the YAML file or directory to formatdstar
: Enable double-star expansionexclude
: Exclude files matching the specified patterngitignore_excludes
: Exclude files matching patterns specified in.gitignore
gitignore_path
: Path to the.gitignore
fileextensions
: List of file extensions to formatformatter
: Set the formatter to use
- name: Run yamlfmt with options
uses: yk-lab/yamlfmt-action@v1
with:
path: '.github/workflows'
A1. Yes, you can include a configuration file like .yamlfmt
in your repository to customize yamlfmt
behavior.
A2. You can specify exclude patterns using yamlfmt
options. Refer to the yamlfmt documentation for details.
Contributions are welcome! Feel free to open an issue or submit a pull request.
Steps to Contribute:
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin feature/your-feature
- Open a pull request.
This project is licensed under the MIT License.