diff --git a/roles/close_deployment/tasks/main.yml b/roles/close_deployment/tasks/main.yml index 6e4bf37a..36abfcf6 100644 --- a/roles/close_deployment/tasks/main.yml +++ b/roles/close_deployment/tasks/main.yml @@ -2,17 +2,19 @@ # Closes a successful GitHub deployment, depends on deployment variable # registered by create_deployment task ### -- block: - - name: Close GitHub deployment as a success. - uri: - url: '{{ deployment.json.url }}/statuses' - body_format: json - method: POST - status_code: 201 - body: - state: "success" - description: "Deployment succeeded" - headers: - Authorization: "token {{ github_token }}" - when: deploy_environment != "staging" - # no rescue because if this fails, closing an errored deploy will too! + +- name: Close GitHub deployment as a success. + tags: + - gh_deploy + uri: + url: "{{ deployment.json.url }}/statuses" + body_format: json + method: POST + status_code: 201 + body: + state: "success" + description: "Deployment succeeded" + headers: + Authorization: "token {{ github_token }}" + when: deploy_environment != "staging" + # no rescue because if this fails, closing an errored deploy will too! diff --git a/roles/create_deployment/tasks/main.yml b/roles/create_deployment/tasks/main.yml index 1409d73b..dbf97662 100644 --- a/roles/create_deployment/tasks/main.yml +++ b/roles/create_deployment/tasks/main.yml @@ -4,22 +4,24 @@ # a success. ### - name: Create a GitHub deployment + tags: + - gh_deploy block: - name: Check for GitHub token, and fail if not present fail: - msg: "Pass a GitHub API token to -e github_token or set in environment as ANSIBLE_GITHUB_TOKEN" + msg: "Pass a GitHub API token to -e github_token or set in environment as ANSIBLE_GITHUB_TOKEN" when: github_token == "" - name: Create a deployment uri: - url: '{{ deployments_endpoint }}' + url: "{{ deployments_endpoint }}" body_format: json method: POST status_code: 201 body: - ref: '{{ gitref }}' - environment: '{{ deploy_environment }}' - description: '{{ deploy_description }}' - required_contexts: '{{ deploy_contexts }}' + ref: "{{ gitref }}" + environment: "{{ deploy_environment }}" + description: "{{ deploy_description }}" + required_contexts: "{{ deploy_contexts }}" auto_merge: false headers: Authorization: "token {{ github_token }}" @@ -27,7 +29,7 @@ register: deployment - name: Set status to in progress uri: - url: '{{ deployment.json.url }}/statuses' + url: "{{ deployment.json.url }}/statuses" body_format: json method: POST status_code: 201