57 lines
1.6 KiB
YAML
57 lines
1.6 KiB
YAML
name: Update Mod Versions
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 * * * *' # Run every hour
|
|
workflow_dispatch: # Allow manual triggers
|
|
|
|
jobs:
|
|
update-versions:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.10'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install requests
|
|
|
|
- name: Update mod versions
|
|
run: |
|
|
python .github/scripts/update_mod_versions.py
|
|
|
|
- name: Generate App Token
|
|
id: generate_token
|
|
uses: tibdex/github-app-token@v1
|
|
with:
|
|
app_id: ${{ secrets.APP_ID }}
|
|
private_key: ${{ secrets.APP_PRIVATE_KEY }}
|
|
|
|
- name: Commit and push changes
|
|
env:
|
|
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
|
|
run: |
|
|
git config --global user.name 'GitHub App'
|
|
git config --global user.email 'github-app[bot]@users.noreply.github.com'
|
|
|
|
if [[ $(git status --porcelain) ]]; then
|
|
COMMIT_MSG="Auto-update mod versions"
|
|
if [ -f commit_message.txt ]; then
|
|
COMMIT_MSG=$(cat commit_message.txt)
|
|
fi
|
|
|
|
git add mods/*/meta.json
|
|
git commit -m "$COMMIT_MSG"
|
|
git push https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git HEAD:main
|
|
else
|
|
echo "No changes to commit"
|
|
fi
|
|
|