Skip to content

Commit

Permalink
Add validatorVersion on API responses
Browse files Browse the repository at this point in the history
Return git hash on netlify, based on COMMIT_REF env variable or package.json's version
Close #77
  • Loading branch information
PierrickP committed Aug 19, 2022
1 parent 9812481 commit e541382
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions gbfs-validator/gbfs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const got = require('got')
const validate = require('./validate')
const validatorVersion = require('./package.json').version

function hasErrors(data, required) {
let hasError = false
Expand Down Expand Up @@ -424,6 +425,9 @@ class GBFS {
if (!gbfsResult.version) {
return {
summary: {
validatorVersion: process.env.COMMIT_REF
? process.env.COMMIT_REF.substring(0, 7)
: validatorVersion,
versionUnimplemented: true
}
}
Expand Down Expand Up @@ -566,6 +570,9 @@ class GBFS {

return {
summary: {
validatorVersion: process.env.COMMIT_REF
? process.env.COMMIT_REF.substring(0, 7)
: validatorVersion,
version: {
detected: result[0].version,
validated: this.options.version || result[0].version
Expand Down
5 changes: 5 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
command = "yarn build"
publish = "dist/website"
functions = "dist/functions"

[[plugins]]
package = "netlify-plugin-inline-functions-env"
[plugins.inputs]
buildEvent = "onBuild"

0 comments on commit e541382

Please sign in to comment.