Update workflow
This commit is contained in:
22
.github/workflows/update-mod-versions.yml
vendored
22
.github/workflows/update-mod-versions.yml
vendored
@@ -3,13 +3,11 @@ name: Update Mod Versions
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 * * * *' # Run every hour
|
||||
workflow_dispatch: # Allow manual triggers # Remove the scheduled cron job during testing
|
||||
workflow_dispatch: # Allow manual triggers
|
||||
|
||||
jobs:
|
||||
update-versions:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write # Needed to push changes
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
@@ -26,17 +24,23 @@ jobs:
|
||||
pip install requests
|
||||
|
||||
- name: Update mod versions
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
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 Actions Bot'
|
||||
git config --global user.email 'actions@github.com'
|
||||
git config --global user.name 'GitHub App'
|
||||
git config --global user.email 'github-app[bot]@users.noreply.github.com'
|
||||
|
||||
# Check if there are changes to commit
|
||||
if [[ $(git status --porcelain) ]]; then
|
||||
COMMIT_MSG="Auto-update mod versions"
|
||||
if [ -f commit_message.txt ]; then
|
||||
@@ -45,7 +49,7 @@ jobs:
|
||||
|
||||
git add mods/*/meta.json
|
||||
git commit -m "$COMMIT_MSG"
|
||||
git push
|
||||
git push https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git HEAD:main
|
||||
else
|
||||
echo "No changes to commit"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user