# This action will check that LinuxGSM is picking up game server config and parameter variables.
name: Details Check
on:
workflow_dispatch:
push:
branches:
- develop
pull_request:
branches:
- develop
permissions:
contents: read
concurrency:
group: details-check-${{ github.ref_name }}
cancel-in-progress: true
env:
LGSM_REF: ${{ github.event.pull_request.head.sha || github.sha }}
jobs:
create-matrix:
if: github.repository_owner == 'GameServerManagers'
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
legacy: ${{ steps.set-matrix.outputs.legacy }}
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ env.LGSM_REF }}
# Full history so the base branch ref is available for the
# `git diff origin/...HEAD` comparison below (a shallow
# checkout has no origin/ and the diff fails).
fetch-depth: 0
- name: Detect targeted servers (PR only)
id: targeted
if: github.event_name == 'pull_request'
run: |
changed=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
echo "Changed files:"
echo "$changed"
# Only these modules directly affect what 'details', 'parse-game-details'
# and 'query-raw' output. Everything else (install, fix, update, check_*,
# data CSVs, game icons, etc.) is irrelevant to this check.
details_core='^(linuxgsm\.sh|lgsm/modules/(info_game|info_messages|command_details|command_dev_parse_game_details|command_dev_query_raw|core_modules)\.sh|\.github/workflows/action-details-check\.yml|\.github/scripts/details-check-.*\.sh)$'
if echo "$changed" | grep -qE "${details_core}"; then
echo "Details-relevant core file changed — using full matrix."
echo "mode=full" >> "$GITHUB_OUTPUT"
else
# Extract shortnames from changed config-lgsm paths
shortnames=$(echo "$changed" \
| grep -oE 'lgsm/config-default/config-lgsm/[a-z0-9]+server' \
| sed 's|lgsm/config-default/config-lgsm/||;s|server$||' \
| sort -u)
if [ -z "$shortnames" ]; then
echo "No server configs or core files changed — skipping matrix."
echo "mode=skip" >> "$GITHUB_OUTPUT"
else
echo "Targeted servers: $shortnames"
echo "mode=targeted" >> "$GITHUB_OUTPUT"
echo "$shortnames" > targeted_shortnames.txt
fi
fi
- name: Generate matrix
if: github.event_name != 'pull_request' || steps.targeted.outputs.mode != 'skip'
run: |
if [ -f targeted_shortnames.txt ]; then
TARGETED_SHORTNAMES=$(cat targeted_shortnames.txt) .github/scripts/details-check-generate-matrix.sh
else
.github/scripts/details-check-generate-matrix.sh
fi
- name: Set Matrix
id: set-matrix
run: |
if [ ! -f shards.json ]; then
echo 'matrix={"include":[]}' >> "$GITHUB_OUTPUT"
echo 'legacy=' >> "$GITHUB_OUTPUT"
else
cat shards.json
echo "matrix=$(cat shards.json)" >> "$GITHUB_OUTPUT"
echo "legacy=$(cat legacy.txt)" >> "$GITHUB_OUTPUT"
fi
details-check:
name: details-check (${{ matrix.shard }})
# Skip (rather than fail the run) when create-matrix found nothing to check.
if: github.repository_owner == 'GameServerManagers' && needs.create-matrix.outputs.matrix != '{"include":[]}'
needs: create-matrix
continue-on-error: true
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.create-matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ env.LGSM_REF }}
- name: Cache apt packages
uses: actions/cache@v6
with:
path: /var/cache/apt/archives
key: apt-${{ runner.os }}-libxml2-utils-jq
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libxml2-utils jq
- name: Details check
run: .github/scripts/details-check-run.sh ${{ matrix.shortnames }}
details-check-legacy:
name: details-check (legacy)
if: github.repository_owner == 'GameServerManagers' && needs.create-matrix.outputs.legacy != ''
needs: create-matrix
continue-on-error: true
runs-on: ubuntu-latest
container: public.ecr.aws/ubuntu/ubuntu:20.04
steps:
- name: Install dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
apt-get update
apt-get install -y --no-install-recommends ca-certificates curl wget git sudo iproute2 libxml2-utils jq \
bc binutils bsdmainutils bzip2 cpio distro-info file gzip hostname lib32gcc-s1 lib32stdc++6 \
netcat-openbsd pigz python3 tar tmux unzip util-linux uuid-runtime xz-utils
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ env.LGSM_REF }}
- name: Details check
run: |
useradd -m linuxgsm
echo "linuxgsm ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/linuxgsm
chown -R linuxgsm:linuxgsm "${GITHUB_WORKSPACE}"
chmod a+w "${GITHUB_STEP_SUMMARY}"
sudo -u linuxgsm -H env LGSM_REF="${LGSM_REF}" GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" GITHUB_STEP_SUMMARY="${GITHUB_STEP_SUMMARY}" \
"${GITHUB_WORKSPACE}/.github/scripts/details-check-run.sh" ${{ needs.create-matrix.outputs.legacy }}