chore: Configure repository for ParadeDB #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# workflows/lint-format.yml | |
# | |
# Lint Format | |
# Lint the project's file trailing spaces, line endings, and format. | |
name: Lint Format | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
workflow_dispatch: | |
concurrency: | |
group: lint-format-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint-format: | |
name: Lint File Endings & Trailing Whitespaces | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.draft == false | |
steps: | |
- name: Checkout Git Repository | |
uses: actions/checkout@v4 | |
- name: Install fd Search Tool | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y fd-find | |
mkdir -p "$HOME/.local/bin" | |
sudo ln -s $(which fdfind) "$HOME/.local/bin/fd" | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Add Trailing Newlines | |
run: .github/workflows/helpers/lint_trailing_newlines.sh | |
- name: Check for CRLF Files | |
run: | | |
FILES=$(git ls-files --eol | grep crlf || true) | |
if [[ ! -z "$FILES" ]]; then | |
echo "The following files have incorrect line endings:" | |
echo "$FILES" | |
false | |
fi | |
- name: Check for Trailing Whitespaces | |
run: | | |
FILES=$(git grep -Ilr '[[:blank:]]$' || true) | |
if [[ ! -z "$FILES" ]]; then | |
echo "The following files have trailing whitespaces:" | |
echo "$FILES" | |
exit 1 | |
fi | |
- name: Print Modified Files | |
run: | | |
FILES=$(git ls-files --modified) | |
if [[ ! -z "$FILES" ]]; then | |
echo "The following files have incorrect trailing newlines:" | |
echo "$FILES" | |
echo "Please fix them using .github/workflows/helpers/lint_trailing_newlines.sh" | |
false | |
fi |