-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f4b0db2
commit 7dd38e9
Showing
4 changed files
with
89 additions
and
5 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,15 @@ | ||
name: gitme | ||
on: [push, pull_request] | ||
jobs: | ||
check-valid-flights: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: "18.x" | ||
- run: "TZ='America/New_York'; export TZ" | ||
- run: npm install | ||
- run: node ci.js | ||
env: | ||
FLIGHT_API_TOKEN: ${{ secrets.AEROAPI_TOKEN_GH }} |
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
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,36 @@ | ||
require("dotenv").config() | ||
const yaml = require('js-yaml'); | ||
const utils = require("./utils") | ||
const fs = require('fs'); | ||
var config = "" | ||
|
||
try { | ||
config = yaml.load(fs.readFileSync('./config.yaml', 'utf8')); | ||
} catch (e) { | ||
console.error("Failed to parse YAML. See below:") | ||
console.error(e) | ||
process.exit(1) | ||
} | ||
|
||
config.events.forEach(async event => { | ||
console.log(`Checking event: ${event.name}`) | ||
event.users.map(async user => { | ||
var flights = await Promise.all(user.flights.map(async flight => { | ||
var res | ||
try { | ||
res = await utils.checkFlight(flight.code, new Date(flight.date)); | ||
} catch (e) { | ||
console.error(`Failed to get flight info for event ${event.name}: ${flight.code} on ${flight.date} for user ${user.name}/${user.id}`) | ||
process.exit(e) | ||
} | ||
if (res.error) { | ||
console.error(`Failed to get flight info for event ${event.name}: ${flight.code} on ${flight.date} for user ${user.name}/${user.id}`) | ||
process.exit(1) | ||
} | ||
console.error(`PASS: ${event.name}: ${flight.code} on ${flight.date} for user ${user.name}/${user.id}`) | ||
})) | ||
flights = flights.filter(item => item).sort(function (a, b) { | ||
return new Date(a.scheduled_out) - new Date(b.scheduled_out); | ||
}); | ||
}) | ||
}) |
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