Use the gerritaction worker to query Gerrit resources and apply actions to matching changes through the Gerrit API.
Use this skill when the user wants to:
The worker is configured by skill/config.yml:
apiVersion: v1
kind: worker
metadata:
name: gerritaction
spec:
gerrit:
host: http://127.0.0.1/
port: 8080
user: user
pass: pass
Required fields:
apiVersion: v1kind: workermetadata.name: gerritactionspec.gerrit.host: Gerrit base URL including schemespec.gerrit.port: Gerrit portspec.gerrit.user: Gerrit usernamespec.gerrit.pass: Gerrit passwordpip install gerritaction before running commands.gerritaction instead of python action.py.--config-file with a .yml or .yaml file.--account-query, --change-query, --group-query, or --project-query.--change-action together with --change-query in the same invocation.--output-file only for a new .json file path. The command rejects an existing file.--output-file is omitted, query results are printed to standard output as JSON.Use --account-query to search accounts.
Example:
pip install gerritaction
gerritaction --config-file="skill/config.yml" --account-query="name:john email:example.com"
Use --change-query to search changes.
Example:
pip install gerritaction
gerritaction --config-file="skill/config.yml" --change-query="status:open since:2024-01-01 until:2024-01-02"
Use --group-query to search groups.
Example:
pip install gerritaction
gerritaction --config-file="skill/config.yml" --group-query="name:admin member:john"
Use --project-query to search projects. Project results are enriched with project config, branches, and tags.
Example:
pip install gerritaction
gerritaction --config-file="skill/config.yml" --project-query="name:test state:active"
The worker supports these change actions:
add-reviewer:account-id[,account-id...]delete-reviewer:account-id[,account-id...]add-attention:account-id[,account-id...]remove-attention:account-id[,account-id...]approve-change:Label=Value[,Label=Value...]delete-changesubmit-changeMultiple actions can be chained in one --change-action value, separated by spaces.
Example:
pip install gerritaction
gerritaction \
--config-file="skill/config.yml" \
--change-query="status:open project:test" \
--change-action="add-reviewer:1001,1002 approve-change:Code-Review=+2"
--output-file when the caller needs a persistent JSON artifact.--change-query.Example:
pip install gerritaction
gerritaction \
--config-file="skill/config.yml" \
--project-query="name:test state:active" \
--output-file="/tmp/projects.json"
delete-change or submit-change, make sure the change query is narrow and explicit.--change-query and --change-action in the same command.--output-file with a new .json path.--change-action without --change-query.共 1 个版本