From f0906c9faea9cc09a804ac8718fe3acb38d2743d Mon Sep 17 00:00:00 2001 From: Kseniya Shychko Date: Fri, 31 May 2024 11:04:11 +0200 Subject: [PATCH] feat: generate diff files using jq for big jsonld files (#15) * feat: run diff for jsonld files before commit * fix: diff script * chore: catch unlocode.jsonld download exit code * chore: check diff script exit codes * update UN/LOCODE vocabulary --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .github/workflows/package.yml | 10 ++++++++++ vocab/unlocode-diff.txt | 2 ++ vocab/unlocode-subdivisions-diff.txt | 0 3 files changed, 12 insertions(+) create mode 100644 vocab/unlocode-diff.txt create mode 100644 vocab/unlocode-subdivisions-diff.txt diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index d1eeb80a51..cf9ca748ca 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -63,6 +63,16 @@ jobs: mv unlocode-sorted.jsonld unlocode.jsonld mv *.jsonld ../../vocab/ + - name: runn diff + working-directory: vocab/ + run: | + curl -o unlocode-main.jsonld https://raw.githubusercontent.com/uncefact/vocabulary-outputs/main/unlocode.jsonld && echo "Downloaded" + diff <(jq --sort-keys . unlocode-main.jsonld) <(jq --sort-keys . unlocode.jsonld) > unlocode-diff.txt && echo "Diff created" + curl -o unlocode-subdivisions-main.jsonld https://raw.githubusercontent.com/uncefact/vocabulary-outputs/main/unlocode-subdivisions.jsonld && echo "Downloaded" + diff <(jq --sort-keys . unlocode-subdivisions-main.jsonld) <(jq --sort-keys . unlocode-subdivisions.jsonld) > unlocode-subdivisions-diff.txt && echo "Diff created" + rm unlocode-main.jsonld && echo "File removed" + rm unlocode-subdivisions-main.jsonld && echo "File removed" + - name: commit json-ld working-directory: vocab/ run: | diff --git a/vocab/unlocode-diff.txt b/vocab/unlocode-diff.txt new file mode 100644 index 0000000000..50e4357c4a --- /dev/null +++ b/vocab/unlocode-diff.txt @@ -0,0 +1,2 @@ +7a8 +> "unlcdf": "https://vocabulary.uncefact.org/unlocode-functions#", diff --git a/vocab/unlocode-subdivisions-diff.txt b/vocab/unlocode-subdivisions-diff.txt new file mode 100644 index 0000000000..e69de29bb2