forked from openwebwork/webwork2
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (45 loc) · 1.48 KB
/
Copy pathcheck-formats.yml
File metadata and controls
53 lines (45 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
name: Check Formatting of Code Base
defaults:
run:
shell: bash
on:
push:
branches-ignore: [main, develop]
pull_request:
jobs:
perltidy:
name: Check file formatting with perltidy and prettier
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y libmojolicious-perl cpanminus
sudo cpanm -n Perl::Tidy@20260204
- name: Check Perl file formatting with perltidy
shell: bash
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
shopt -s extglob globstar nullglob
perl_files=(./**/*.p[lm] ./**/*.t ./**/*.at)
for f in bin/* bin/dev_scripts/*; do
if [[ -f "$f" && ! "$f" == *.* ]]; then
if head -n 1 "$f" | grep -qE '^#!.*(\bperl\b)'; then
perl_files+=("$f")
fi
fi
done
if [ ${#perl_files[@]} -gt 0 ]; then
perltidy --pro=./.perltidyrc -b -bext='/' "${perl_files[@]}"
git diff --exit-code
fi
- name: Install Node
uses: actions/setup-node@v6
with:
node-version: '24'
- name: Install Dependencies
run: cd htdocs && npm ci --ignore-scripts
- name: Check JavaScript, style, and HTML file formatting with prettier
run: cd htdocs && npm run prettier-check