community.general.github_release 模块 – 与 GitHub Releases 交互
注意
此模块是 community.general 集合 (版本 10.1.0) 的一部分。
如果您使用的是 ansible 软件包,则可能已安装此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install community.general。您需要其他要求才能使用此模块,请参阅 要求了解详情。
要在 playbook 中使用它,请指定:community.general.github_release。
概要
- 获取有关 GitHub Releases 的元数据 
要求
在执行此模块的主机上需要以下要求。
- github3.py >= 1.0.0a3 
参数
| 参数 | 注释 | 
|---|---|
| 要执行的操作 选项 
 | |
| 创建发行版时的发行版说明 | |
| 设置发行版是否为草稿。(布尔值) 选项 
 | |
| 创建发行版时的发行版名称 | |
| 用户的 GitHub 帐户密码。与  | |
| 设置发行版是否为预发行版。(布尔值) 选项 
 | |
| 仓库名称 | |
| 创建发行版时的标签名称。使用  | |
| 创建发行版时的发行版目标 | |
| 用于身份验证的 GitHub 个人访问令牌。与  | |
| 拥有仓库的 GitHub 帐户 | 
属性
| 属性 | 支持 | 描述 | 
|---|---|---|
| 支持:完全支持 | 可以在  | |
| 支持:不支持 | 在差异模式下,将返回有关已更改内容(或可能需要在  | 
示例
- name: Get latest release of a public repository
  community.general.github_release:
    user: ansible
    repo: ansible
    action: latest_release
- name: Get latest release of testuseer/testrepo
  community.general.github_release:
    token: tokenabc1234567890
    user: testuser
    repo: testrepo
    action: latest_release
- name: Get latest release of test repo using username and password
  community.general.github_release:
    user: testuser
    password: secret123
    repo: testrepo
    action: latest_release
- name: Create a new release
  community.general.github_release:
    token: tokenabc1234567890
    user: testuser
    repo: testrepo
    action: create_release
    tag: test
    target: master
    name: My Release
    body: Some description
返回值
公共返回值已记录在 此处,以下是此模块独有的字段
| 键 | 描述 | 
|---|---|
| 已创建/最新版本的版本。 返回:成功 示例: | 
