Skip to content

Commit d07066e

Browse files
committed
feat(ci): Add prettier CI workflow
Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent 51813a0 commit d07066e

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed

.github/workflows/lint-prettier.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
2+
# SPDX-License-Identifier: MIT
3+
4+
name: Lint prettier
5+
6+
on: pull_request
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: lint-prettier-${{ github.head_ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
changes:
17+
runs-on: ubuntu-latest
18+
19+
outputs:
20+
src: ${{ steps.changes.outputs.src}}
21+
22+
steps:
23+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
24+
id: changes
25+
continue-on-error: true
26+
with:
27+
filters: |
28+
src:
29+
- '.github/workflows/**'
30+
- 'lib/**'
31+
- 'appinfo/info.xml'
32+
- 'package.json'
33+
- 'package-lock.json'
34+
- 'tsconfig.json'
35+
- '.prettierignore'
36+
- '**.js'
37+
- '**.ts'
38+
- '**.vue'
39+
- '**.yml'
40+
- '**.md'
41+
42+
lint:
43+
runs-on: ubuntu-latest
44+
45+
needs: changes
46+
if: needs.changes.outputs.src != 'false'
47+
48+
name: NPM format
49+
50+
steps:
51+
- name: Checkout
52+
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
53+
54+
- name: Read package.json node and npm engines version
55+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
56+
id: versions
57+
with:
58+
fallbackNode: '^20'
59+
fallbackNpm: '^10'
60+
61+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
62+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v3
63+
with:
64+
node-version: ${{ steps.versions.outputs.nodeVersion }}
65+
66+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
67+
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
68+
69+
- name: Install dependencies
70+
env:
71+
CYPRESS_INSTALL_BINARY: 0
72+
PUPPETEER_SKIP_DOWNLOAD: true
73+
run: npm ci
74+
75+
- name: Format
76+
run: npm run format
77+
78+
summary:
79+
permissions:
80+
contents: none
81+
runs-on: ubuntu-latest
82+
needs: [changes, lint]
83+
84+
if: always()
85+
86+
# This is the summary, we just avoid to rename it so that branch protection rules still match
87+
name: prettier
88+
89+
steps:
90+
- name: Summary status
91+
run: if ${{ needs.changes.outputs.src != 'false' && needs.lint.result != 'success' }}; then exit 1; fi

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
# Compiled JS output
1111
js/
1212

13+
# Handled by transifex
14+
l10n/
15+
1316
# PHP
1417
lib/
1518
**/*.php

0 commit comments

Comments
 (0)