From c79d4b6ddfeb0078e19fa46054be72c2d83f2346 Mon Sep 17 00:00:00 2001 From: andrphilippi Date: Thu, 3 Sep 2026 13:59:47 +0200 Subject: [PATCH] AAE-47554 Add actionlint to pre-commit config --- .gitattributes | 2 ++ .github/workflows/pre-commit.yml | 34 ++++++++++++++++++++++++++++++++ .husky/pre-commit | 8 +++++++- .pre-commit-config.yaml | 6 ++++++ 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pre-commit.yml create mode 100644 .pre-commit-config.yaml diff --git a/.gitattributes b/.gitattributes index 1b06f3ebf5..7b47eec7e4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,3 @@ .github/workflows/*.lock.yml linguist-generated=true merge=ours +*.sh text eol=lf +.husky/* text eol=lf diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000000..18cd4c5bfd --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,34 @@ +name: "pre-commit" + +on: + pull_request: + branches: + - develop + - master + - develop-patch* + - master-patch* + paths: + - '.github/workflows/**' + - '.github/actions/**' + - '.pre-commit-config.yaml' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + pre-commit: + name: "Run pre-commit hooks" + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - name: Run pre-commit + uses: Alfresco/alfresco-build-tools/.github/actions/pre-commit@da99ab845e78301fcb0680d16cbc185a40a1938c # v18.24.1 + with: + skip_checkout: true diff --git a/.husky/pre-commit b/.husky/pre-commit index ad7554c52e..3a52ec841e 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -2,4 +2,10 @@ export NODE_OPTIONS=--max_old_space_size=8192 -lint-staged +lint-staged || exit 1 + +if command -v pre-commit >/dev/null 2>&1; then + pre-commit run +else + echo "pre-commit not found on PATH - skipping workflow lint locally (CI enforces it). Install: https://pre-commit.com/#install" +fi diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..88e8794912 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,6 @@ +repos: + - repo: https://github.com/rhysd/actionlint + rev: 914e7df21a07ef503a81201c76d2b11c789d3fca # frozen: v1.7.12 + hooks: + - id: actionlint + exclude: '\.lock\.yml$'