-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt to add checks for pull requests
- Loading branch information
Showing
3 changed files
with
70 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
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 | ||
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); | ||
} |
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters