Skip to content

Commit ff1c2df

Browse files
committed
Bootstrap tap git identity for v0.3.0 release
Configure repo-local git identity before the public workflow creates the Homebrew tap commit.
1 parent 2eef50e commit ff1c2df

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

scripts/release/publish_release.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,45 @@ def ensure_clean_repo(repo_dir: Path) -> None:
147147
raise SystemExit(f"tap repo has uncommitted changes: {repo_dir}")
148148

149149

150+
def ensure_git_identity(repo_dir: Path) -> None:
151+
name = run(
152+
["git", "config", "--local", "--get", "user.name"],
153+
cwd=repo_dir,
154+
check=False,
155+
).stdout.strip()
156+
email = run(
157+
["git", "config", "--local", "--get", "user.email"],
158+
cwd=repo_dir,
159+
check=False,
160+
).stdout.strip()
161+
if name and email:
162+
return
163+
run(
164+
["git", "config", "--local", "user.name", "github-actions[bot]"],
165+
cwd=repo_dir,
166+
capture=False,
167+
)
168+
run(
169+
[
170+
"git",
171+
"config",
172+
"--local",
173+
"user.email",
174+
"41898282+github-actions[bot]@users.noreply.github.com",
175+
],
176+
cwd=repo_dir,
177+
capture=False,
178+
)
179+
180+
150181
def update_homebrew_tap(
151182
meta: ReleaseMetadata,
152183
*,
153184
tap_repo_dir: Path,
154185
template_path: Path,
155186
) -> None:
156187
ensure_clean_repo(tap_repo_dir)
188+
ensure_git_identity(tap_repo_dir)
157189
formula = render_homebrew_formula(meta, template_path.read_text(encoding="utf-8"))
158190
formula_path = tap_repo_dir / "crill.rb"
159191
if not formula_path.exists() or formula_path.read_text(encoding="utf-8") != formula:

0 commit comments

Comments
 (0)