Skip to content

Commit

Permalink
Add a workflow to check versions in the modpack index
Browse files Browse the repository at this point in the history
See #5.
  • Loading branch information
lmoureaux committed Jan 4, 2024
1 parent 8658617 commit 15e5dd4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/check-versions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: Louis Moureaux <[email protected]>

name: Check versions
on:
push: {}
pull_request: {}

jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: sudo apt-get install curl jq
- run: sh check-versions.sh

21 changes: 21 additions & 0 deletions check-versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: blabber <blabber@github>

# Checks that the version numbers in the index file match those in the
# modpacks.

IFS='|'
jq -r '.modpacks[] | "\(.name)|\(.version)|\(.url)"' index.json \
| while read NAME VERSION URL; do
RVERSION=$({ if $(echo "$URL" | grep -q '^http'); then
curl -s "$URL"
else
cat "$URL"
fi } | jq -r '.info.version')

[ "$VERSION" != "$RVERSION" ] \
&& echo "Version mismatch for \"$NAME\": index $VERSION; remote $RVERSION"
done

0 comments on commit 15e5dd4

Please sign in to comment.