summaryrefslogtreecommitdiff
path: root/.github/workflows/update-mods.yml
blob: 79f6b71acb67053927dcb67d7334d2ccc76c965b (plain)
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
name: Update mods
on:
  workflow_dispatch:
  schedule:
    - cron: '0 0 * * *'
jobs:
  update-mods:
    runs-on: ubuntu-latest
    steps:
      - name: get packwiz
        run: |
          curl -fsSLo ~/packwiz.zip https://nightly.link/packwiz/packwiz/workflows/go/main/Linux%2064-bit%20x86.zip
          unzip -d ~ ~/packwiz.zip
          chmod 755 ~/packwiz
      - uses: actions/[email protected]
      - name: update mods
        run: |
          echo "y" | ~/packwiz update --all
      - name: check for changes
        id: git-check
        run: |
          echo ::set-output name=modified::$(if git status --porcelain | grep -E 'pack.toml|index.toml|mods\/' > /dev/null; then echo "true"; else echo "false"; fi)
      - name: commit updates
        if: steps.git-check.outputs.modified == 'true'
        run: |
          git config --global user.name 'github-actions[bot]'
          git config --global user.email 'github-actions[bot]@users.noreply.github.com'

          git add mods/ index.toml pack.toml
          git commit -m "chore: update mods"
          git push