fruivita/corporate

View on GitHub
.github/workflows/normalize.yml

Summary

Maintainability
Test Coverage
###############################################################################
# About GitHub Actions                                                        #
# https://docs.github.com/en/actions/learn-github-actions                     #
# https://www.youtube.com/watch?v=TLB5MY9BBa4                                 #
###############################################################################
#
# Standardizes the formatting of the composer.json file according to the scheme
# proposed by the composers developers
#
# Motivation: https://localheinz.com/blog/2018/01/15/normalizing-composer.json/
# Schema: https://getcomposer.org/schema.json

name: Normalize

on:
  workflow_dispatch:
  push:
    paths:
      - 'composer.json'

concurrency:
  group: normalize-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

jobs:
  normalize:
    runs-on: ubuntu-latest

    name: Normalize composer.json

    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          ref: ${{ github.head_ref }}

      - name: Run
        run: |
          composer global require ergebnis/composer-normalize
          composer normalize

      - name: Auto Commit
        uses: stefanzweifel/git-auto-commit-action@v4
        with:
          commit_message: 'style(composer): normalize composer.json'
          branch: ${{ github.head_ref }}