diff --git a/docs/docsite/rst/porting_guide_2.5.rst b/docs/docsite/rst/porting_guide_2.5.rst index 3b844e6588..eb625fe573 100644 --- a/docs/docsite/rst/porting_guide_2.5.rst +++ b/docs/docsite/rst/porting_guide_2.5.rst @@ -64,7 +64,12 @@ Modules Major changes in popular modules are detailed here -No notable changes. +github_release +-------------- + +In Ansible versions 2.4 and older, after creating a GitHub release using the ``create_release`` state, the ``github_release`` module reported state as ``skipped``. +In Ansible version 2.5 and later, after creating a GitHub release using the ``create_release`` state, the ``github_release`` module now reports state as ``changed``. + Modules removed --------------- diff --git a/lib/ansible/modules/source_control/github_release.py b/lib/ansible/modules/source_control/github_release.py index 1584021be8..f8d9f6631b 100644 --- a/lib/ansible/modules/source_control/github_release.py +++ b/lib/ansible/modules/source_control/github_release.py @@ -116,6 +116,15 @@ EXAMPLES = ''' ''' RETURN = ''' +create_release: + description: + - Version of the created release + - "For Ansible version 2.5 and later, if specified release version already exists, then State is unchanged" + - "For Ansible versions prior to 2.5, if specified release version already exists, then State is skipped" + type: string + returned: success + sample: 1.1.0 + latest_release: description: Version of the latest release type: string @@ -201,15 +210,14 @@ def main(): if action == 'create_release': release_exists = repository.release_from_tag(tag) if release_exists: - module.exit_json( - skipped=True, msg="Release for tag %s already exists." % tag) + module.exit_json(changed=False, msg="Release for tag %s already exists." % tag) release = repository.create_release( tag, target, name, body, draft, prerelease) if release: - module.exit_json(tag=release.tag_name) + module.exit_json(changed=True, tag=release.tag_name) else: - module.exit_json(tag=None) + module.exit_json(changed=False, tag=None) if __name__ == '__main__':