From 6dab899c9d186b561b610e7167f157d946a105af Mon Sep 17 00:00:00 2001
From: Chris Schinnerl <chris@sia.tech>
Date: Tue, 5 Nov 2024 10:06:11 +0100
Subject: [PATCH 1/6] add walletd support

---
 Formula/walletd.rb | 17 +++++++++++++++++
 README.md          |  1 +
 2 files changed, 18 insertions(+)
 create mode 100644 Formula/walletd.rb

diff --git a/Formula/walletd.rb b/Formula/walletd.rb
new file mode 100644
index 0000000..607f281
--- /dev/null
+++ b/Formula/walletd.rb
@@ -0,0 +1,17 @@
+class Walletd < Formula
+  desc "Walletd: The new Sia wallet"
+  homepage "https://github.com/SiaFoundation/walletd"
+  url "https://github.com/SiaFoundation/walletd.git", :tag => "v0.8.0"
+
+  depends_on "go" => :build
+  depends_on "gcc" => :build
+
+  def install
+    system "go", "generate", "./..."
+    system "go", "build", "-tags='netgo'", "-trimpath", "-o", bin/"walletd", "-a", "-ldflags", "-s -w", "./cmd/walletd"
+  end
+
+  test do
+    system "#{bin}/walletd", "version"
+  end
+end
diff --git a/README.md b/README.md
index 59f688a..227f784 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,7 @@ Or `brew tap siafoundation/sia` and then `brew install <formula>`.
 
 - [renterd](https://github.com/SiaFoundation/renterd)
 - [hostd](https://github.com/SiaFoundation/hostd)
+- [walletd](https://github.com/SiaFoundation/walletd)
 
 ## Documentation
 

From b1223b6fca2e88b145d3b007fcfcb14e935f7689 Mon Sep 17 00:00:00 2001
From: Chris Schinnerl <chris@sia.tech>
Date: Tue, 5 Nov 2024 10:18:41 +0100
Subject: [PATCH 2/6] test.yml: fix install

---
 .github/workflows/test.yml | 45 +++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 23 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index e670425..179991d 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -2,33 +2,32 @@ name: Test
 
 on:
   push:
-    branches: [ master ]
+    branches: [master]
   pull_request:
-    branches: [ master ]
+    branches: [master]
 
 jobs:
   test:
     runs-on: macos-latest
 
     steps:
-    - name: Check out Git repository
-      uses: actions/checkout@v3
-
-    - name: Set up Homebrew
-      run: |
-        brew update
-        brew tap homebrew/cask
-
-    - name: Install
-      run: brew install --build-from-source Formula/*.rb
-
-    - name: Test
-      run: brew test Formula/*.rb
-
-    - name: Audit
-      run: |
-        for formula in Formula/*.rb; do
-          formula_name=$(basename $formula .rb)
-          brew audit --strict --online $formula_name
-        done
-
+      - name: Check out Git repository
+        uses: actions/checkout@v4
+
+      - name: Set up Homebrew
+        run: |
+          brew update
+          brew tap homebrew/cask
+
+      - name: Install
+        run: brew install --formula --build-from-source Formula/*.rb
+
+      - name: Test
+        run: brew test Formula/*.rb
+
+      - name: Audit
+        run: |
+          for formula in Formula/*.rb; do
+            formula_name=$(basename $formula .rb)
+            brew audit --strict --online $formula_name
+          done

From 4a3ccb32f94fa9cacad4303dcc559f4b2d51d2bf Mon Sep 17 00:00:00 2001
From: Chris Schinnerl <chris@sia.tech>
Date: Tue, 5 Nov 2024 11:01:43 +0100
Subject: [PATCH 3/6] test.yml: update audit step

---
 .github/workflows/test.yml | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 179991d..506fd75 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -27,7 +27,10 @@ jobs:
 
       - name: Audit
         run: |
-          for formula in Formula/*.rb; do
-            formula_name=$(basename $formula .rb)
-            brew audit --strict --online $formula_name
+          brew tap-new siafoundation/test --no-git
+          cp -r Formula/* $(brew --repository)/Library/Taps/siafoundation/homebrew-test/Formula
+          for file in $(brew --repository)/Library/Taps/siafoundation/homebrew-test/Formula/*
+          do
+              brew audit --formula "$(basename ${file%.rb})"
           done
+          brew untap siafoundation/test

From 2debed720e965ba6a2de6b7f936a5f012a2651e9 Mon Sep 17 00:00:00 2001
From: Chris Schinnerl <chris@sia.tech>
Date: Tue, 5 Nov 2024 11:12:33 +0100
Subject: [PATCH 4/6] fix audit

---
 Formula/hostd.rb   | 10 +++++-----
 Formula/renterd.rb | 10 +++++-----
 Formula/walletd.rb |  9 +++++----
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/Formula/hostd.rb b/Formula/hostd.rb
index 5c776ea..52e6601 100644
--- a/Formula/hostd.rb
+++ b/Formula/hostd.rb
@@ -1,18 +1,18 @@
 class Hostd < Formula
-  desc "Hostd: A host for Sia"
+  desc "Hosting daemon for the Sia network"
   homepage "https://github.com/SiaFoundation/hostd"
-  url "https://github.com/SiaFoundation/hostd.git", :tag => "v1.1.2"
+  url "https://github.com/SiaFoundation/hostd.git", tag: "v1.1.2"
 
-  depends_on "go" => :build
   depends_on "gcc" => :build
+  depends_on "go" => :build
 
   def install
     system "go", "generate", "./..."
-    system "go", "build", "-tags='netgo'", "-trimpath", "-o", bin/"hostd", "-a", "-ldflags", "-s -w", "./cmd/hostd"
+    system "go", "build", "-tags='netgo'", "-trimpath", "-o", bin/"hostd",
+           "-a", "-ldflags", "-s -w", "./cmd/hostd"
   end
 
   test do
     system "#{bin}/hostd", "version"
   end
 end
-
diff --git a/Formula/renterd.rb b/Formula/renterd.rb
index f61e4c6..b20672c 100644
--- a/Formula/renterd.rb
+++ b/Formula/renterd.rb
@@ -1,18 +1,18 @@
 class Renterd < Formula
-  desc "Renterd: The Next-Gen Sia Renter"
+  desc "Renting application for the Sia network"
   homepage "https://github.com/SiaFoundation/renterd"
-  url "https://github.com/SiaFoundation/renterd.git", :tag => "v1.0.8"
+  url "https://github.com/SiaFoundation/renterd.git", tag: "v1.0.8"
 
-  depends_on "go" => :build
   depends_on "gcc" => :build
+  depends_on "go" => :build
 
   def install
     system "go", "generate", "./..."
-    system "go", "build", "-tags='netgo'", "-o", bin/"renterd", "-a", "-ldflags", "-s -w", "./cmd/renterd"
+    system "go", "build", "-tags='netgo'", "-trimpath", "-o", bin/"renterd",
+           "-a", "-ldflags", "-s -w", "./cmd/renterd"
   end
 
   test do
     system "#{bin}/renterd", "version"
   end
 end
-
diff --git a/Formula/walletd.rb b/Formula/walletd.rb
index 607f281..760bb64 100644
--- a/Formula/walletd.rb
+++ b/Formula/walletd.rb
@@ -1,14 +1,15 @@
 class Walletd < Formula
-  desc "Walletd: The new Sia wallet"
+  desc "Dedicated Sia wallet"
   homepage "https://github.com/SiaFoundation/walletd"
-  url "https://github.com/SiaFoundation/walletd.git", :tag => "v0.8.0"
+  url "https://github.com/SiaFoundation/walletd.git", tag: "v0.8.0"
 
-  depends_on "go" => :build
   depends_on "gcc" => :build
+  depends_on "go" => :build
 
   def install
     system "go", "generate", "./..."
-    system "go", "build", "-tags='netgo'", "-trimpath", "-o", bin/"walletd", "-a", "-ldflags", "-s -w", "./cmd/walletd"
+    system "go", "build", "-tags='netgo'", "-trimpath", "-o", bin/"walletd",
+           "-a", "-ldflags", "-s -w", "./cmd/walletd"
   end
 
   test do

From 4420c5db2899d6f7fe295e4cb346254ffc5fe13e Mon Sep 17 00:00:00 2001
From: Chris Schinnerl <chris@sia.tech>
Date: Tue, 5 Nov 2024 11:41:20 +0100
Subject: [PATCH 5/6] formula-update.yml: update sed

---
 .github/workflows/formula-update.yml | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/.github/workflows/formula-update.yml b/.github/workflows/formula-update.yml
index 0a9a850..d768b52 100644
--- a/.github/workflows/formula-update.yml
+++ b/.github/workflows/formula-update.yml
@@ -5,14 +5,14 @@ on:
     types: [release-tagged]
   workflow_dispatch:
     inputs:
-        tag:
-            description: 'Version to build'
-            required: true
-            default: 'v1.0.3'
-        project: 
-            description: 'Project to build'
-            required: true
-            default: 'renterd'
+      tag:
+        description: "Version to build"
+        required: true
+        default: "v1.0.3"
+      project:
+        description: "Project to build"
+        required: true
+        default: "renterd"
 
 jobs:
   update-formula:
@@ -32,14 +32,15 @@ jobs:
         uses: actions/checkout@v3
 
       - name: Update Homebrew Formula for ${{ env.PROJECT }}
-        run: sed -i 's/:tag => "[^"]*"/:tag => "${{  env.RELEASE_TAG }}"/' ./Formula/${{ env.PROJECT }}.rb
+        run: |
+          sed -i 's/tag: "[^"]*"/tag: "${{  env.RELEASE_TAG }}"/' ./Formula/${{ env.PROJECT }}.rb
 
       - name: Create Pull Request
         uses: peter-evans/create-pull-request@v5.0.2
         with:
           token: ${{ secrets.GITHUB_TOKEN }}
-          commit-message: '${{ env.PROJECT }}: ${{ env.RELEASE_TAG }}'
-          title: '${{ env.PROJECT }}: ${{ env.RELEASE_TAG }}'
-          body: 'This is an automated PR to update the ${{ env.PROJECT }} formula'
+          commit-message: "${{ env.PROJECT }}: ${{ env.RELEASE_TAG }}"
+          title: "${{ env.PROJECT }}: ${{ env.RELEASE_TAG }}"
+          body: "This is an automated PR to update the ${{ env.PROJECT }} formula"
           branch: ${{ env.PROJECT }}/update
           base: master

From c80b07de2f91bd569e876f93d82357c7f4cebdf5 Mon Sep 17 00:00:00 2001
From: Chris Schinnerl <chris@sia.tech>
Date: Wed, 6 Nov 2024 09:31:04 +0100
Subject: [PATCH 6/6] formula-update.yml: update create pull request action and
 add permissions

---
 .github/workflows/formula-update.yml | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/formula-update.yml b/.github/workflows/formula-update.yml
index d768b52..ec0b5ee 100644
--- a/.github/workflows/formula-update.yml
+++ b/.github/workflows/formula-update.yml
@@ -14,6 +14,10 @@ on:
         required: true
         default: "renterd"
 
+permissions:
+  contents: write
+  pull-requests: write
+
 jobs:
   update-formula:
     runs-on: ubuntu-latest
@@ -36,9 +40,9 @@ jobs:
           sed -i 's/tag: "[^"]*"/tag: "${{  env.RELEASE_TAG }}"/' ./Formula/${{ env.PROJECT }}.rb
 
       - name: Create Pull Request
-        uses: peter-evans/create-pull-request@v5.0.2
+        uses: peter-evans/create-pull-request@v7
         with:
-          token: ${{ secrets.GITHUB_TOKEN }}
+          delete-branch: true
           commit-message: "${{ env.PROJECT }}: ${{ env.RELEASE_TAG }}"
           title: "${{ env.PROJECT }}: ${{ env.RELEASE_TAG }}"
           body: "This is an automated PR to update the ${{ env.PROJECT }} formula"