Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/credfeto/action-yaml-format

Reformat YAML files
https://github.com/credfeto/action-yaml-format

Last synced: about 1 month ago
JSON representation

Reformat YAML files

Awesome Lists containing this project

README

        

# Reformat YAML Files

[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)

Reformats YAML files

* Removes trailing whitepace
* Converts tabs to spaces

## How to use it?
This is a GitHub action, so it has to be added to a GitHub workflow.

A simple example of running this action on all pushes to the repository would be
to add a `reformatyaml.yml` file under `.github/workflows` with the following content
```yaml
on: [push]

jobs:
reformat-sql:
runs-on: ubuntu-latest
steps:
# Checkout the source code so there are some files to look at.
- uses: actions/checkout@v3
with:
fetch-depth: 0
# Run the reformat action
- name: Reformat YAML Files
uses: credfeto/[email protected]
- name: Commit files
run: |
git config --local user.email "@users.noreply.github.com"
git config --local user.name "YAML Reformat Bot"
git commit --all -m"Reformat YAML Files to common format." || true
- name: Push
run: git push "https://${{github.actor}}:${{secrets.SOURCE_PUSH_TOKEN}}@github.com/${{github.repository}}.git" "HEAD:${{ env.GIT_BRANCH }}"
```

On each push, it will reformat the YAML files. Note you'll need to commit and push any commits back to your github repo.

## Contributors



Oskar Stark
Oskar Stark

💻