Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef96e932 authored by Guillaume Jacquart's avatar Guillaume Jacquart
Browse files

Merge branch '6366-no_fail_on_no_changes' into 'main'

6366: no pipeline fail when no data changes

See merge request !7
parents cf317b62 45370887
Loading
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -23,8 +23,5 @@ build-list:
    - git config --global user.email "$GITLAB_USER_EMAIL"

  script: 
    - node build_list.js
    - node validate_json.js
    - git add list/e_trackers.json
    - git commit -m "Auto update trackers list"
    - git push origin HEAD:main
    - doupdate.sh
+6 −1
Original line number Diff line number Diff line
@@ -8,6 +8,8 @@ const https = require('https')
const fs = require('fs')
const url = require('url')

const EXIT_CODE_NO_CHANGES = 5

function fetch(url) {
    return new Promise((resolve, reject) => {
      https.get(url, (response) => {
@@ -56,6 +58,7 @@ fetch(adawayUri)
})
.then(toto => {
    if (listHasNoChanges()) {
    	process.exitCode = EXIT_CODE_NO_CHANGES
        throw "No changes in trackers, abort updating."
    }
})
@@ -69,8 +72,10 @@ fetch(adawayUri)
    console.log("DONE")
})
.catch(err => {
    if (process.exitCode === undefined) {
        process.exitCode = 1
    }
    console.log(err)
    process.exit(1)
})


doupdate.sh

0 → 100755
+22 −0
Original line number Diff line number Diff line
#!/bin/sh


node build_list.js

RETVAL=$?

case "$RETVAL" in
    "0")
        node validate_json.js
        git add list/e_trackers.json
        git commit -m "Auto update trackers list"
        git push origin HEAD:main
        ;;
    "5")
        RETVAL=0
        ;;
    *)
        ;;
esac

exit $RETVAL