-
Notifications
You must be signed in to change notification settings - Fork 40
71 lines (65 loc) · 2.39 KB
/
check.yml
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Check files syntactically valid
on:
pull_request:
branches: ["master"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
check:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check whether city files are valid
uses: ali-kamalizade/[email protected]
with:
directory: 'web/cities'
ecmaVersion: 'es5'
files: '*.js'
- name: Check whether station files are valid
uses: ali-kamalizade/[email protected]
with:
directory: 'web/stations'
ecmaVersion: 'es5'
files: '*.js'
- name: Check whether European station logos are present
uses: actions/github-script@v7
with:
script: |
const fs = require("fs");
let stationsFile = fs.readFileSync("web/stations/stations-europe.js", "utf8");
fs.writeFileSync("stations-europe-module.js", stationsFile + "\nexports.stations = stations;");
let stations = require("./stations-europe-module.js")
let failed = false;
for (const [key, value] of Object.entries(stations.stations)) {
for (const elem of value) {
if (!fs.existsSync("web/" + elem["logo"])) {
console.error(elem["logo"] + " missing!");
failed = true;
}
}
}
if (failed) {
process.exit(1);
}
- name: Check whether American station logos are present
uses: actions/github-script@v7
with:
script: |
const fs = require("fs");
let stationsFile = fs.readFileSync("web/stations/stations-america.js", "utf8");
fs.writeFileSync("stations-america-module.js", stationsFile + "\nexports.stations = stations;");
let stations = require("./stations-america-module.js")
let failed = false;
for (const [key, value] of Object.entries(stations.stations)) {
for (const elem of value) {
if (!fs.existsSync("web/" + elem["logo"])) {
console.error(elem["logo"] + " missing!");
failed = true;
}
}
}
if (failed) {
process.exit(1);
}