This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 8cc5393f46f Update information about gh tool needed to run workflows
by RMs (#51751)
8cc5393f46f is described below
commit 8cc5393f46f4e427b3d2a2233b5b24e2b1f44f06
Author: Jarek Potiuk <[email protected]>
AuthorDate: Sun Jun 15 12:42:38 2025 +0200
Update information about gh tool needed to run workflows by RMs (#51751)
---
dev/breeze/doc/01_installation.rst | 11 +++++++++++
dev/breeze/src/airflow_breeze/utils/gh_workflow_utils.py | 13 +++++++++++++
2 files changed, 24 insertions(+)
diff --git a/dev/breeze/doc/01_installation.rst
b/dev/breeze/doc/01_installation.rst
index 08b567c0d4a..9b54ed17d75 100644
--- a/dev/breeze/doc/01_installation.rst
+++ b/dev/breeze/doc/01_installation.rst
@@ -157,6 +157,17 @@ We highly recommend using ``uv`` to manage your Python
environments, as it is ve
easy to use, it is faster than any of the other tools availables (way faster!)
and has a lot of features
that make it easier to work with Python.
+The ``gh`` cli needed for release managers
+------------------------------------------
+
+The ``gh`` GitHub CLI is a command line tool that allows you to interact with
GitHub repositories, issues, pull
+requests, and more. It is useful for release managers to automate tasks such
as creating releases,
+managing issues, and starting workflows (for example during documentation
building). Release
+managers should have ``gh`` installed (see `gh installation guide
<https://github.com/cli/cli>`_) and they
+should follow configuration steps to authorize ``gh`` in their local airflow
repository (basically
+running ``gh auth login`` command and following the instructions).
+
+
Alternative: pipx tool
----------------------
diff --git a/dev/breeze/src/airflow_breeze/utils/gh_workflow_utils.py
b/dev/breeze/src/airflow_breeze/utils/gh_workflow_utils.py
index 30659b363b0..4a2cd0d7ef8 100644
--- a/dev/breeze/src/airflow_breeze/utils/gh_workflow_utils.py
+++ b/dev/breeze/src/airflow_breeze/utils/gh_workflow_utils.py
@@ -19,6 +19,7 @@ from __future__ import annotations
import json
import sys
import time
+from shutil import which
from airflow_breeze.utils.console import get_console
from airflow_breeze.utils.run_utils import run_command
@@ -54,6 +55,16 @@ def tigger_workflow(workflow_name: str, repo: str, branch:
str = "main", **kwarg
time.sleep(5)
+def make_sure_gh_is_installed():
+ if not which("gh"):
+ get_console().print(
+ "[red]Error! The `gh` tool is not installed.[/]\n\n"
+ "[yellow]You need to install `gh` tool (see
https://github.com/cli/cli) and "
+ "run `gh auth login` to connect your repo to GitHub."
+ )
+ sys.exit(1)
+
+
def get_workflow_run_id(workflow_name: str, repo: str) -> int:
"""
Get the latest workflow run ID for a given workflow name and repository.
@@ -61,6 +72,7 @@ def get_workflow_run_id(workflow_name: str, repo: str) -> int:
:param workflow_name: The name of the workflow to check.
:param repo: The repository in the format 'owner/repo'.
"""
+ make_sure_gh_is_installed()
command = [
"gh",
"run",
@@ -96,6 +108,7 @@ def get_workflow_run_info(run_id: str, repo: str, fields:
str) -> dict:
:param repo: Workflow repository example: 'apache/airflow'
:param fields: Comma-separated fields to retrieve from the workflow run to
fetch. eg: "status,conclusion,name,jobs"
"""
+ make_sure_gh_is_installed()
command = ["gh", "run", "view", run_id, "--json", fields, "--repo", repo]
result = run_command(command, capture_output=True, check=False)