A reusable workflow and composite action for linting line endings.
Add a new workflow under .github/workflows/ with the following contents,
name: Check Line Endings
on:
push:
branches: [ master, dev ]
pull_request:
branches: [ master, dev ]
jobs:
check-eol:
uses: Arthri/check-eol/.github/workflows/i.yml@v2
permissions:
contents: readAdd the following step to the desired jobs.
jobs:
job:
- name: Check Line Endings
uses: Arthri/check-eol-composite@v2The workflow enforces LF for all files in the index. The workflow and action operate agnostic of autocrlf=true, as the config option modifies files in the working tree rather than the index.
The following example configures the reusable workflow to enforce CRLF instead.
jobs:
check-eol:
uses: Arthri/check-eol/.github/workflows/i.yml@v2
with:
default-eol: crlfAnd the following demonstrates the equivalent for composite actions.
jobs:
job:
- name: Check Line Endings
uses: Arthri/check-eol-composite@v2
with:
default-eol: crlfThe reusable workflow, by default, checkouts the ref of the branch or tag that triggered the workflow. An example is provided below demonstrating how to change the checkout dev instead. For more information about the default ref, see github.ref in Accessing contextual information about workflow runs.
jobs:
check-eol:
uses: Arthri/check-eol/.github/workflows/i.yml@v2
with:
ref: devThe reusable workflow is not limited to pushes and pull requests, other types of events such as releases are also supported.