2021-01-06 20:37:59 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
2020-11-22 20:50:07 +00:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2022-11-11 09:55:08 +00:00
|
|
|
name: Frontend / Lint
|
2020-08-31 10:48:58 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2022-11-11 09:55:08 +00:00
|
|
|
branches: [ develop ]
|
2020-08-31 10:48:58 +00:00
|
|
|
pull_request:
|
2022-11-11 09:55:08 +00:00
|
|
|
branches: [ develop ]
|
2022-10-21 16:57:29 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
NODE_VERSION: 18
|
2020-08-31 10:48:58 +00:00
|
|
|
|
2022-11-11 09:55:08 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: frontend
|
|
|
|
|
2020-08-31 10:48:58 +00:00
|
|
|
jobs:
|
2022-11-11 09:55:08 +00:00
|
|
|
changes:
|
|
|
|
name: Check for frontend changes
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
pull-requests: read
|
|
|
|
outputs:
|
2022-11-21 16:24:36 +00:00
|
|
|
changed: ${{ github.event_name == 'push' || steps.changed.outputs.files }}
|
2022-11-11 09:55:08 +00:00
|
|
|
steps:
|
2023-01-08 22:11:23 +00:00
|
|
|
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
2022-11-21 16:24:36 +00:00
|
|
|
if: github.event_name != 'push'
|
|
|
|
|
2022-11-11 09:55:08 +00:00
|
|
|
- name: Check for frontend file changes
|
2022-11-21 16:24:36 +00:00
|
|
|
if: github.event_name != 'push'
|
2023-01-08 22:11:23 +00:00
|
|
|
uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
|
2022-11-11 09:55:08 +00:00
|
|
|
id: changed
|
|
|
|
with:
|
|
|
|
filters: |
|
|
|
|
files:
|
2022-12-04 21:41:39 +00:00
|
|
|
- 'commons/**'
|
2022-11-11 09:55:08 +00:00
|
|
|
- 'frontend/**'
|
|
|
|
- '.github/**'
|
|
|
|
- '.yarn/**'
|
|
|
|
|
2020-08-31 10:48:58 +00:00
|
|
|
lint:
|
2022-11-11 09:55:08 +00:00
|
|
|
needs: changes
|
2020-08-31 10:48:58 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Lints all .ts and .tsx files
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2022-11-11 09:55:08 +00:00
|
|
|
if: needs.changes.outputs.changed == 'true'
|
2023-01-08 22:11:23 +00:00
|
|
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
2020-11-29 09:07:44 +00:00
|
|
|
|
2022-11-29 16:36:57 +00:00
|
|
|
- name: Setup node
|
2022-11-11 09:55:08 +00:00
|
|
|
if: needs.changes.outputs.changed == 'true'
|
2022-11-29 16:36:57 +00:00
|
|
|
uses: ./.github/actions/setup-node
|
2020-08-31 10:48:58 +00:00
|
|
|
with:
|
2022-11-29 16:36:57 +00:00
|
|
|
NODE_VERSION: ${{ env.NODE_VERSION }}
|
2022-07-02 14:46:43 +00:00
|
|
|
|
2021-06-06 21:14:00 +00:00
|
|
|
- name: Lint code
|
2022-11-11 09:55:08 +00:00
|
|
|
if: needs.changes.outputs.changed == 'true'
|
2022-07-02 14:46:43 +00:00
|
|
|
run: yarn lint
|