Skip to content

Commit 5204be8

Browse files
authored
Merge pull request #29 from nextcloud-libraries/chore/lint-prettier
ci: Add prettier also to CI
2 parents 88a9a3e + 6e569e4 commit 5204be8

1 file changed

Lines changed: 91 additions & 0 deletions

File tree

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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
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

0 commit comments

Comments
 (0)