forked from YimMenu-Lua/Samurais-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (71 loc) · 2.94 KB
/
offsets.yml
File metadata and controls
87 lines (71 loc) · 2.94 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
77
78
79
80
81
82
83
84
85
86
87
name: Update Offsets
on:
workflow_dispatch:
schedule:
- cron: '0 2 * * 6'
concurrency:
group: ss_offsets-${{ github.ref }}
cancel-in-progress: true
jobs:
update-offsets:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Fetch Upstream
run: |
git ls-remote https://github.com/acidlabsgg/gtav-legacy-scripts HEAD | cut -f1 > legacy_upstream.txt
git ls-remote https://github.com/acidlabsgg/gtav-enhanced-scripts HEAD | cut -f1 > enhanced_upstream.txt
- name: Read Saved Commit Hashes
id: saved_commits
run: |
if [ -f dev/scripts/offsets/legacy.last_commit_hash ]; then
cat dev/scripts/offsets/legacy.last_commit_hash > last_commit_legacy
else
echo "none" > last_commit_legacy
fi
if [ -f dev/scripts/offsets/enhanced.last_commit_hash ]; then
cat dev/scripts/offsets/enhanced.last_commit_hash > last_commit_enhanced
else
echo "none" > last_commit_enhanced
fi
- name: Compare Commits
id: compare_commits
run: |
LEGACY_UPSTREAM=$(cat legacy_upstream.txt)
ENHANCED_UPSTREAM=$(cat enhanced_upstream.txt)
LEGACY_LAST=$(cat last_commit_legacy)
ENHANCED_LAST=$(cat last_commit_enhanced)
echo "Legacy Upstream: $LEGACY_UPSTREAM"
echo "Legacy Last Run: $LEGACY_LAST"
echo "Enhanced Upstream: $ENHANCED_UPSTREAM"
echo "Enhanced Last Run: $ENHANCED_LAST"
if [ "$LEGACY_UPSTREAM" = "$LEGACY_LAST" ] && [ "$ENHANCED_UPSTREAM" = "$ENHANCED_LAST" ] && [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
echo "run=false" >> $GITHUB_OUTPUT
else
echo "run=true" >> $GITHUB_OUTPUT
fi
- name: Setup Python
if: steps.compare_commits.outputs.run == 'true'
uses: actions/setup-python@v5
with:
python-version: "3.12.x"
- name: Run Offset Updater
if: steps.compare_commits.outputs.run == 'true'
run: |
python ./dev/scripts/offsets/update_offsets.py
- name: Save New Commit Hashes
if: steps.compare_commits.outputs.run == 'true'
run: |
cp legacy_upstream.txt ./dev/scripts/offsets/legacy.last_commit_hash
cp enhanced_upstream.txt ./dev/scripts/offsets/enhanced.last_commit_hash
- name: Commit Changes
if: steps.compare_commits.outputs.run == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add dev/scripts/offsets/legacy.last_commit_hash
git add dev/scripts/offsets/enhanced.last_commit_hash
git add SSV2/includes/data/globals_locals.lua
git diff --cached --quiet || git commit -m "chore(offsets): update script globals & locals"
git push