Skip to content

Commit b77cb18

Browse files
committedSep 13, 2024
Split actions into three files
1 parent 7d70270 commit b77cb18

File tree

3 files changed

+70
-20
lines changed

3 files changed

+70
-20
lines changed
 
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Deprecation ESLint check
2+
3+
on:
4+
workflow_call:
5+
pull_request:
6+
types: [opened, synchronize]
7+
branches-ignore: [staging, production]
8+
paths: ['**.js', '**.ts', '**.tsx', '**.json', '**.mjs', '**.cjs', 'config/.editorconfig', '.watchmanconfig', '.imgbotconfig']
9+
10+
concurrency:
11+
group: ${{ github.ref == 'refs/heads/main' && format('{0}-{1}', github.ref, github.sha) || github.ref }}-deprecation-lint
12+
cancel-in-progress: true
13+
14+
jobs:
15+
deprecation-lint:
16+
name: Deprecation ESLint check
17+
if: ${{ github.actor != 'OSBotify' || github.event_name == 'workflow_call' }}
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Node
24+
uses: ./.github/actions/composite/setupNode
25+
26+
- name: Run ESLint to check for deprecation warnings
27+
run: |
28+
git fetch origin main --no-tags --depth=1
29+
30+
# shellcheck disable=SC2046
31+
npm run lint-deprecation

‎.github/workflows/lint.yml

+2-20
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Lint code
1+
name: ESLint check
22

33
on:
44
workflow_call:
@@ -13,7 +13,7 @@ concurrency:
1313

1414
jobs:
1515
lint:
16-
name: Run ESLint
16+
name: ESLint check
1717
if: ${{ github.actor != 'OSBotify' || github.event_name == 'workflow_call' }}
1818
runs-on: ubuntu-latest
1919
steps:
@@ -27,21 +27,3 @@ jobs:
2727
run: npm run lint
2828
env:
2929
CI: true
30-
31-
- name: Run ESLint with stricter checks on changed files
32-
run: |
33-
# shellcheck disable=SC2046
34-
npx eslint --config ./.eslintrc.pr.js $(git diff --diff-filter=AM --name-only main -- "*.js" "*.ts" "*.tsx")
35-
36-
- name: Verify there's no Prettier diff
37-
run: |
38-
npm run prettier -- --loglevel silent
39-
if ! git diff --name-only --exit-code; then
40-
# shellcheck disable=SC2016
41-
echo 'Error: Prettier diff detected! Please run `npm run prettier` and commit the changes.'
42-
exit 1
43-
fi
44-
45-
- name: Run unused style searcher
46-
shell: bash
47-
run: ./.github/scripts/findUnusedKeys.sh

‎.github/workflows/prettier.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Prettier check
2+
3+
on:
4+
workflow_call:
5+
pull_request:
6+
types: [opened, synchronize]
7+
branches-ignore: [staging, production]
8+
paths: ['**.js', '**.ts', '**.tsx', '**.json', '**.mjs', '**.cjs', 'config/.editorconfig', '.watchmanconfig', '.imgbotconfig']
9+
10+
concurrency:
11+
group: ${{ github.ref == 'refs/heads/main' && format('{0}-{1}', github.ref, github.sha) || github.ref }}-prettier
12+
cancel-in-progress: true
13+
14+
jobs:
15+
prettier:
16+
name: Prettier check
17+
if: ${{ github.actor != 'OSBotify' || github.event_name == 'workflow_call' }}
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Node
24+
uses: ./.github/actions/composite/setupNode
25+
26+
- name: Verify there's no Prettier diff
27+
run: |
28+
npm run prettier -- --loglevel silent
29+
if ! git diff --name-only --exit-code; then
30+
# shellcheck disable=SC2016
31+
echo 'Error: Prettier diff detected! Please run `npm run prettier` and commit the changes.'
32+
exit 1
33+
fi
34+
35+
- name: Run unused style searcher
36+
shell: bash
37+
run: ./.github/scripts/findUnusedKeys.sh

0 commit comments

Comments
 (0)
Please sign in to comment.