diff --git a/Library/Homebrew/dev-cmd/update-license-data.rb b/Library/Homebrew/dev-cmd/update-license-data.rb
index aa05702186998531e00d55f9033548cfcede7027..952a46ee2736d780e27c9a23efc81d7dc9ed0293 100644
--- a/Library/Homebrew/dev-cmd/update-license-data.rb
+++ b/Library/Homebrew/dev-cmd/update-license-data.rb
@@ -1,28 +1,26 @@
 # frozen_string_literal: true
 
-require "commands"
 require "cli/parser"
-require "json"
-require "net/http"
-require "open-uri"
+require "utils/github"
 
 module Homebrew
   module_function
 
   SPDX_PATH = (HOMEBREW_LIBRARY_PATH/"data/spdx.json").freeze
-  SPDX_DATA_URL = "https://raw.githubusercontent.com/spdx/license-list-data/HEAD/json/licenses.json"
+  SPDX_API_URL = "https://api.github.com/repos/spdx/license-list-data/releases/latest"
 
   def update_license_data_args
     Homebrew::CLI::Parser.new do
       usage_banner <<~EOS
-        `update_license_data` <cmd>
+        `update-license-data` [<options>]
 
          Update SPDX license data in the Homebrew repository.
       EOS
       switch "--fail-if-changed",
              description: "Return a failing status code if current license data's version is different from " \
                           "the upstream. This can be used to notify CI when the SPDX license data is out of date."
-
+      switch "--commit",
+             description: "Commit changes to the SPDX license data."
       max_named 0
     end
   end
@@ -30,10 +28,18 @@ module Homebrew
   def update_license_data
     update_license_data_args.parse
     ohai "Updating SPDX license data..."
-    curl_download(SPDX_DATA_URL, to: SPDX_PATH, partial: false)
 
-    return unless args.fail_if_changed?
+    latest_tag = GitHub.open_api(SPDX_API_URL)["tag_name"]
+    data_url = "https://raw.githubusercontent.com/spdx/license-list-data/#{latest_tag}/json/licenses.json"
+    curl_download(data_url, to: SPDX_PATH, partial: false)
+
+    Homebrew.failed = !system("git", "diff", "--stat", "--exit-code", SPDX_PATH) if args.fail_if_changed?
+
+    return unless args.commit?
 
-    safe_system "git", "diff", "--stat", "--exit-code", SPDX_PATH
+    ohai "git add"
+    safe_system "git", "add", SPDX_PATH
+    ohai "git commit"
+    system "git", "commit", "--message", "data/spdx.json: update to #{latest_tag}"
   end
 end
diff --git a/docs/Manpage.md b/docs/Manpage.md
index fffec405be15bd79505587b20ecda604753ce00d..a41eb26a2f07aa604c6e9412d9ab6a09948d935f 100644
--- a/docs/Manpage.md
+++ b/docs/Manpage.md
@@ -1048,12 +1048,14 @@ directory.
 * `-g`, `--git`:
   Initialise a Git repository in the unpacked source. This is useful for creating patches for the software.
 
-### `update_license_data` *`cmd`*
+### `update-license-data` [*`options`*]
 
  Update SPDX license data in the Homebrew repository.
 
 * `--fail-if-changed`:
   Return a failing status code if current license data's version is different from the upstream. This can be used to notify CI when the SPDX license data is out of date.
+* `--commit`:
+  Commit changes to the SPDX license data.
 
 ### `update-test` [*`options`*]
 
diff --git a/manpages/brew.1 b/manpages/brew.1
index b2805d9c8468edc049f6a55a4ce78a003d7c9d45..25e5ce2cc4e161363c42278651bad86e9102cc84 100644
--- a/manpages/brew.1
+++ b/manpages/brew.1
@@ -1357,13 +1357,17 @@ Patches for \fIformula\fR will be applied to the unpacked source\.
 \fB\-g\fR, \fB\-\-git\fR
 Initialise a Git repository in the unpacked source\. This is useful for creating patches for the software\.
 .
-.SS "\fBupdate_license_data\fR \fIcmd\fR"
+.SS "\fBupdate\-license\-data\fR [\fIoptions\fR]"
 Update SPDX license data in the Homebrew repository\.
 .
 .TP
 \fB\-\-fail\-if\-changed\fR
 Return a failing status code if current license data\'s version is different from the upstream\. This can be used to notify CI when the SPDX license data is out of date\.
 .
+.TP
+\fB\-\-commit\fR
+Commit changes to the SPDX license data\.
+.
 .SS "\fBupdate\-test\fR [\fIoptions\fR]"
 Run a test of \fBbrew update\fR with a new repository clone\. If no options are passed, use \fBorigin/master\fR as the start commit\.
 .