simple list comprehension actions

#776
Raw
Author
Anonymous
Created
May 31, 2023, 7:57 p.m.
Expires
Never
Size
612 bytes
Hits
68
Syntax
Python
Private
No
    def push_files(self, actions: List[GitLabAction], stage: str) -> None:
        actions = [
            {"action": x.action, "file_path": x.file_path, "content": x.content}
            for x in actions
        ]

        data = {
            "branch": self._branch,
            "commit_message": "batched apps deployed by deploy_bot in {stage}",
            "actions": actions,
        }

        try:
            _ = self._project.commits.create(data)
        except gitlab.GitlabCreateError as e:
            logging.error(e)
            raise InvalidDeploymentFile() from e