Browse Source

fix(workflows): run details-check on PRs and normalize ref resolution

Details Check was not running for PR #4903 because the workflow only
triggered on push to develop/workflow_dispatch. Also, pull_request refs
(refs/pull/*) are not valid raw-content refs for GitHub downloads.

Changes:
- Trigger Details Check on pull_request to develop
- Add LGSM_REF env resolved to PR head SHA or branch ref name
- Use LGSM_REF for linuxgsm.sh download and LGSM_GITHUBBRANCH usage
- Use LGSM_REF in matrix generation when fetching serverlist.csv

This ensures legacy server jobs (bfv, bf1942, btl, onset) are included
and executed during PR validation.
pull/4903/head
Daniel Gibbs 1 month ago
parent
commit
6a0903bfef
  1. 3
      .github/workflows/details-check-generate-matrix.sh
  2. 21
      .github/workflows/details-check.yml

3
.github/workflows/details-check-generate-matrix.sh

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
curl "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${GITHUB_REF#refs/heads/}/lgsm/data/serverlist.csv" | grep -v '^[[:blank:]]*$' > serverlist.csv ref="${LGSM_REF:-${GITHUB_REF#refs/heads/}}"
curl "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${ref}/lgsm/data/serverlist.csv" | grep -v '^[[:blank:]]*$' > serverlist.csv
echo -n "{" > "shortnamearray.json" echo -n "{" > "shortnamearray.json"
echo -n "\"include\":[" >> "shortnamearray.json" echo -n "\"include\":[" >> "shortnamearray.json"

21
.github/workflows/details-check.yml

@ -5,6 +5,9 @@ on:
push: push:
branches: branches:
- develop - develop
pull_request:
branches:
- develop
permissions: permissions:
contents: read contents: read
@ -17,6 +20,8 @@ jobs:
create-matrix: create-matrix:
if: github.repository_owner == 'GameServerManagers' if: github.repository_owner == 'GameServerManagers'
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
LGSM_REF: ${{ github.event.pull_request.head.sha || github.ref_name }}
outputs: outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }} matrix: ${{ steps.set-matrix.outputs.matrix }}
steps: steps:
@ -38,13 +43,15 @@ jobs:
needs: create-matrix needs: create-matrix
continue-on-error: true continue-on-error: true
runs-on: ${{ matrix.runner }} runs-on: ${{ matrix.runner }}
env:
LGSM_REF: ${{ github.event.pull_request.head.sha || github.ref_name }}
strategy: strategy:
matrix: ${{ fromJSON(needs.create-matrix.outputs.matrix) }} matrix: ${{ fromJSON(needs.create-matrix.outputs.matrix) }}
steps: steps:
- name: Download linuxgsm.sh - name: Download linuxgsm.sh
run: wget "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${GITHUB_REF#refs/heads/}/linuxgsm.sh"; chmod +x linuxgsm.sh run: wget "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${LGSM_REF}/linuxgsm.sh"; chmod +x linuxgsm.sh
- name: Install dependencies - name: Install dependencies
run: sudo apt-get install libxml2-utils jq run: sudo apt-get install libxml2-utils jq
@ -53,10 +60,10 @@ jobs:
run: mkdir -p serverfiles run: mkdir -p serverfiles
- name: Grab server - name: Grab server
run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./linuxgsm.sh ${{ matrix.shortname }}server run: LGSM_GITHUBBRANCH="${LGSM_REF}" ./linuxgsm.sh ${{ matrix.shortname }}server
- name: Enable developer mode - name: Enable developer mode
run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server developer run: LGSM_GITHUBBRANCH="${LGSM_REF}" ./${{ matrix.shortname }}server developer
- name: Generate servercfgname - name: Generate servercfgname
id: sets-servercfgname id: sets-servercfgname
@ -73,7 +80,7 @@ jobs:
fi fi
- name: Pre-load LinuxGSM - name: Pre-load LinuxGSM
run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server details run: LGSM_GITHUBBRANCH="${LGSM_REF}" ./${{ matrix.shortname }}server details
- name: Display config - name: Display config
run: | run: |
@ -87,10 +94,10 @@ jobs:
run: grep "startparameters" lgsm/config-default/config-lgsm/${{ matrix.shortname }}server/_default.cfg run: grep "startparameters" lgsm/config-default/config-lgsm/${{ matrix.shortname }}server/_default.cfg
- name: Details - name: Details
run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server details run: LGSM_GITHUBBRANCH="${LGSM_REF}" ./${{ matrix.shortname }}server details
- name: Detect details - name: Detect details
run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server parse-game-details run: LGSM_GITHUBBRANCH="${LGSM_REF}" ./${{ matrix.shortname }}server parse-game-details
- name: Query Raw - name: Query Raw
run: LGSM_GITHUBBRANCH="${GITHUB_REF#refs/heads/}" ./${{ matrix.shortname }}server query-raw run: LGSM_GITHUBBRANCH="${LGSM_REF}" ./${{ matrix.shortname }}server query-raw

Loading…
Cancel
Save