dev-cmd/update-maintainers: write JSON of maintainers

This will be needed for Homebrew/homebrew-test-bot#933.
This commit is contained in:
Carlo Cabrera 2023-05-29 12:02:43 +08:00
parent 89dfe4fc5b
commit 909b8d078e
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0
4 changed files with 14 additions and 4 deletions

1
.github/maintainers.json vendored Normal file
View File

@ -0,0 +1 @@
[]

View File

@ -66,7 +66,8 @@ jobs:
git checkout "README.md" \
"docs/Manpage.md" \
"manpages/brew.1" \
"completions"
"completions" \
".github/maintainers.json"
else
git checkout --no-track -B "${BRANCH}" origin/master
fi
@ -83,7 +84,8 @@ jobs:
then
git add "README.md" \
"docs/Manpage.md" \
"manpages/brew.1"
"manpages/brew.1" \
".github/maintainers.json"
git commit -m "Update maintainers." \
-m "Autogenerated by the [sponsors-maintainers-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow."
COMMITTED=true

View File

@ -26,11 +26,15 @@ module Homebrew
# We assume that only public members wish to be included in the README
public_members = GitHub.public_member_usernames("Homebrew")
maintainers = GitHub.members_by_team("Homebrew", "maintainers")
HOMEBREW_MAINTAINER_JSON.write(maintainers.keys.to_json)
maintainer_json_relative_path = HOMEBREW_MAINTAINER_JSON.relative_path_from(HOMEBREW_REPOSITORY).to_s
members = {
plc: GitHub.members_by_team("Homebrew", "plc"),
tsc: GitHub.members_by_team("Homebrew", "tsc"),
maintainers: GitHub.members_by_team("Homebrew", "maintainers"),
maintainers: maintainers,
}
sentences = {}
@ -53,7 +57,7 @@ module Homebrew
File.write(readme, content)
diff = system_command "git", args: [
"-C", HOMEBREW_REPOSITORY, "diff", "--exit-code", "README.md"
"-C", HOMEBREW_REPOSITORY, "diff", "--exit-code", "README.md", maintainer_json_relative_path
]
if diff.status.success?
ofail "No changes to list of maintainers."

View File

@ -42,6 +42,9 @@ HOMEBREW_CACHE_FORMULA = (HOMEBREW_CACHE/"Formula").freeze
# Where build, postinstall, and test logs of formulae are written to
HOMEBREW_LOGS = Pathname(ENV.fetch("HOMEBREW_LOGS")).expand_path.freeze
# Path to the list of Homebrew maintainers as a JSON file
HOMEBREW_MAINTAINER_JSON = (HOMEBREW_REPOSITORY/".github/maintainers.json").freeze
# Must use `/tmp` instead of `TMPDIR` because long paths break Unix domain sockets
HOMEBREW_TEMP = Pathname(ENV.fetch("HOMEBREW_TEMP")).then do |tmp|
tmp.mkpath unless tmp.exist?