From e5630b39ae07c33740d5e7dd887169f9ba1251bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96=2E=20Efe=20D=2E?= <67526259+skyline69@users.noreply.github.com> Date: Sun, 9 Mar 2025 20:43:38 +0100 Subject: [PATCH] Update workflow --- .github/workflows/update-mod-versions.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/update-mod-versions.yml b/.github/workflows/update-mod-versions.yml index 72856eb3..5c3aeb37 100644 --- a/.github/workflows/update-mod-versions.yml +++ b/.github/workflows/update-mod-versions.yml @@ -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