Skip to content

Run Halo Infinite data aggregation #4715

Run Halo Infinite data aggregation

Run Halo Infinite data aggregation #4715

Workflow file for this run

name: Run Halo Infinite data aggregation
on:
workflow_dispatch:
schedule:
- cron: '*/10 * * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Download latest release asset
env:
GITHUB_TOKEN: ${{ secrets.WAITTIMES_TOOL_REPO_TOKEN }}
run: |
gh release download --repo OpenSpartan/waittimes --pattern 'openspartan-waittimes.zip' --output openspartan-waittimes.zip
- name: List files
run: |
for file in *; do
if [ -f "$file" ]; then
echo "$file: $(stat -c %s "$file") bytes"
fi
done
- name: Unzip release
run: |
unzip openspartan-waittimes.zip -d bin
- name: Write access tokens to file
run: |
cat << EOF > ./bin/access_tokens.json
${{ secrets.ACCESS_TOKENS }}
EOF
- name: Write Xbox tokens to file
run: |
cat << EOF > ./bin/xbox_tokens.json
${{ secrets.XBOX_TOKENS }}
EOF
- name: Write device token to file
run: |
cat << EOF > ./bin/device_token.json
${{ secrets.DEVICE_TOKEN }}
EOF
- name: Clone data repository
run: git clone https://github.com/OpenSpartan/waittimes-datasets.git ./data
- name: Create dev branch if it does not exist
run: |
cd ./data
git fetch origin
echo "Checking if the 'dev' branch exists..."
if git rev-parse --verify origin/dev; then
echo "'dev' branch exists. Checking out the 'dev' branch..."
git checkout dev
echo "Pulling the latest changes from 'origin/dev'..."
git pull origin dev
else
echo "'dev' branch does not exist. Creating a new 'dev' branch..."
git checkout -b dev
fi
echo "Current branch: $(git branch --show-current)"
env:
GITHUB_TOKEN: ${{ secrets.WAITTIMES_DATASETS_REPO_TOKEN }}
- name: Run WaitTimes to get the latest times
run: dotnet ./bin/WaitTimes.dll --build-id 262282.25.01.09.1801-0 --release 1.10 --release-marker hi_1_10_0 --database ./data/datasets/frontlines-wait-times.db --user-agent "SHIVA-2043073184/6.10026.11084.0 (release; PC)"
- name: Commit and push changes
run: |
cd ./data
git config --global user.email "[email protected]"
git config --global user.name "Glibnub"
git remote set-url origin https://[email protected]/OpenSpartan/waittimes-datasets.git
# Fetch the latest changes and merge them
git fetch origin
git checkout dev || git checkout -b dev
git pull origin dev || echo "Branch 'dev' did not exist, created new branch 'dev'"
# Add, commit, and push changes
git add .
git commit -m "Glibnub decided that you need more data."
git push origin dev
env:
GITHUB_TOKEN: ${{ secrets.WAITTIMES_DATASETS_REPO_TOKEN }}
- name: Update secrets
run: |
file_at=$(cat ./bin/access_tokens.json)
file_xt=$(cat ./bin/xbox_tokens.json)
file_dt=$(cat ./bin/device_token.json)
gh secret set ACCESS_TOKENS -b "$file_at"
gh secret set XBOX_TOKENS -b "$file_xt"
gh secret set DEVICE_TOKEN -b "$file_dt"
env:
GITHUB_TOKEN: ${{ secrets.WAITTIMES_AGGREGATOR_SECRETS_GENERATOR }}