Repository navigation
76 lines (64 loc) · 2.49 KB
/
Copy pathsync-games.yml
File metadata and controls
76 lines (64 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Sync Games List
on:
schedule:
- cron: '0 6 * * *' # Daily at 6:00 UTC
workflow_dispatch: # Manual trigger
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v6
- name: Fetch and parse Mudlet games list
run: |
# Fetch TGameDetails.h from Mudlet repo
curl -sf https://raw.githubusercontent.com/Mudlet/Mudlet/development/src/TGameDetails.h -o TGameDetails.h
# Extract game names from the C++ struct
# Pattern matches: { qsl("GameName"), at the start of each game entry
grep -oP '\{\s*qsl\("\K[^"]+' TGameDetails.h | \
grep -Ev "Mudlet Tutorial|Mudlet self-test" | \
sort > mudlet-games.txt
echo "Games found in Mudlet repo:"
cat mudlet-games.txt
echo ""
echo "Total: $(wc -l < mudlet-games.txt) games"
- name: Check for differences
id: diff
run: |
echo "Current GameList.txt:"
cat GameList.txt
echo ""
# Compare sorted versions
if diff -q <(sort GameList.txt) mudlet-games.txt > /dev/null 2>&1; then
echo "No changes detected"
echo "changes=false" >> $GITHUB_OUTPUT
else
echo "Changes detected:"
echo ""
echo "--- Differences ---"
diff <(sort GameList.txt) mudlet-games.txt || true
echo ""
echo "--- Added games ---"
comm -13 <(sort GameList.txt) mudlet-games.txt || true
echo ""
echo "--- Removed games ---"
comm -23 <(sort GameList.txt) mudlet-games.txt || true
echo ""
echo "changes=true" >> $GITHUB_OUTPUT
fi
- name: Update GameList.txt
if: steps.diff.outputs.changes == 'true'
run: mv mudlet-games.txt GameList.txt
- name: Create Pull Request
if: steps.diff.outputs.changes == 'true'
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Sync games list with Mudlet upstream"
title: "Sync games list with Mudlet upstream"
body: |
This PR syncs the games list with [TGameDetails.h](https://github.com/Mudlet/Mudlet/blob/development/src/TGameDetails.h) from the main Mudlet repository.
The sync workflow runs daily and detects any additions or removals of games in the upstream Mudlet codebase.
Please review the changes before merging.
branch: sync-games-from-mudlet
delete-branch: true