| Total Complexity | 3 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | |||
| 8 | class GetDeploymentStatusesAction(BaseGithubAction): |
||
| 9 | def run(self, api_user, repository, deployment_id): |
||
| 10 | |||
| 11 | if api_user: |
||
| 12 | self.token = self._get_user_token(api_user) |
||
| 13 | |||
| 14 | payload = {"id": deployment_id} |
||
| 15 | |||
| 16 | responses = self._request("GET", |
||
| 17 | "/repos/{}/deployments/{}/statuses".format( |
||
| 18 | repository, deployment_id), |
||
| 19 | payload, |
||
| 20 | self.token) |
||
| 21 | results = [] |
||
| 22 | for response in responses: |
||
| 23 | ts_created_at = time.mktime( |
||
| 24 | datetime.datetime.strptime( |
||
| 25 | response['created_at'], |
||
| 26 | "%Y-%m-%dT%H:%M:%SZ").timetuple()) |
||
| 27 | |||
| 28 | results.append({'creator': response['creator']['login'], |
||
| 29 | 'id': response['id'], |
||
| 30 | 'description': response['description'], |
||
| 31 | 'state': response['state'], |
||
| 32 | 'target_url': response['target_url'], |
||
| 33 | 'created_at': response['created_at'], |
||
| 34 | 'updated_at': response['updated_at'], |
||
| 35 | 'ts_created_at': ts_created_at}) |
||
| 36 | |||
| 37 | return results |
||
| 38 |