Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Pre-commit Checks

on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "yarn"
cache-dependency-path: backstage/yarn.lock

- name: Install Backstage dependencies
run: |
cd backstage
yarn install --frozen-lockfile

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install pre-commit
run: pip install pre-commit

- name: Run pre-commit
run: pre-commit run --all-files
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-merge-conflict

- repo: local
hooks:
- id: backstage-typecheck
name: Backstage TypeScript Check
entry: bash -c 'cd backstage && yarn tsc --noEmit'
language: system
files: '^backstage/.*\.(ts|tsx)$'
pass_filenames: false

- id: terraform-fmt
name: Terraform Format Check
entry: terraform fmt -check -recursive
language: system
files: '^platform/.*\.tf$'
pass_filenames: false
Loading
Loading