Skip to content

Commit

Permalink
Don't push duplicate updates when no mods have updated
Browse files Browse the repository at this point in the history
  • Loading branch information
OoLunar committed Jan 10, 2024
1 parent 9daf533 commit eaba64c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/scripts/update-mods.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"

# Check if there are any changes
echo "updated=false" >> $GITHUB_OUTPUT
git diff-index --quiet HEAD
if [ "$?" == "1" ]; then
echo "updated=true" >> $GITHUB_OUTPUT
git add . > /dev/null
git commit -m "\`packwiz refresh\`." > /dev/null
git push > /dev/null
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
update:
name: Update Modpack
runs-on: ubuntu-latest
outputs:
updated: ${{ steps.update-mods.outputs.updated }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -17,9 +19,11 @@ jobs:
- name: Install dependencies
run: go install github.com/packwiz/packwiz@latest
- name: Update Mods and Mod Loaders
id: update-mods
run: ${{ github.workspace }}/.github/scripts/update-mods.sh
process-commit:
needs: update
if: needs.update.outputs.updated == 'true'
uses: ./.github/workflows/process-commit.yml
secrets:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
4 changes: 2 additions & 2 deletions index.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ hash = "69d1178c95a3d5720b1efce946b7ce5d178fddabc7e424dd65ca1834af222d0b"

[[files]]
file = ".github/scripts/update-mods.sh"
hash = "1d66b1fe20a417335b63dc22ba5476aa07905be3640ff822846a7d158234020d"
hash = "564b045999ad6918a5f76624497c0403cc77835b653fdfb5f993101e7502b61b"

[[files]]
file = ".github/workflows/process-commit.yml"
Expand All @@ -26,7 +26,7 @@ hash = "ef0d9b273e6382a1dcd12d4239a024772d6db92e0ded999692c9210674d90f29"

[[files]]
file = ".github/workflows/update.yml"
hash = "bd89aed1d9082b9449f484ef95eb71c3cd7fe41be48c5cf06ffe27cd3b095cab"
hash = "7a33e3daf171676d0ae6aceccb9125236f30aaf888e7d564d3ba774104bc14bf"

[[files]]
file = "LICENSE"
Expand Down
2 changes: 1 addition & 1 deletion pack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pack-format = "packwiz:1.1.0"
[index]
file = "index.toml"
hash-format = "sha256"
hash = "effa857649914bb83f091bad66e971e43982bbe033fe763a1c572c013cd0ca88"
hash = "ed4b1b0f4d867c7de7305de822c261057f75b2396bd936b835c0faf48ea8a638"

[versions]
fabric = "0.15.3"
Expand Down

0 comments on commit eaba64c

Please sign in to comment.