diff --git a/.github/workflows/update-cask.yml b/.github/workflows/update-cask.yml index 14568e55..9e2b5af5 100644 --- a/.github/workflows/update-cask.yml +++ b/.github/workflows/update-cask.yml @@ -12,6 +12,9 @@ jobs: contents: write steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.repository.default_branch }} + fetch-depth: 0 - name: Download and hash release id: release @@ -30,8 +33,13 @@ jobs: - name: Commit run: | + BRANCH="${{ github.event.repository.default_branch }}" git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add Casks/plezy.rb - git diff --staged --quiet || git commit -m "chore: update cask to ${{ steps.release.outputs.version }}" - git push + if ! git diff --staged --quiet; then + git commit -m "chore: update cask to ${{ steps.release.outputs.version }}" + git push origin "HEAD:$BRANCH" + else + echo "No cask changes to commit." + fi