Skip to content

Commit

Permalink
GitAction should not be launched if a PR is closed but not merged (#192)
Browse files Browse the repository at this point in the history
* fix(gitAction): should not be launched if a PR is closed but not merged

* improve logging
  • Loading branch information
RonanMorgan authored May 20, 2024
1 parent 25bd5ad commit 94469dd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/build-push-image.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Build and Push Docker Image

on:
pull_request:
types: [closed]
branches:
- develop
push:
branches:
- develop
Expand Down
5 changes: 2 additions & 3 deletions pyroengine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ def _process_alerts(self) -> None:
# Media creation
if not isinstance(self._alerts[0]["media_id"], int):
self._alerts[0]["media_id"] = self.api_client[cam_id].create_media_from_device().json()["id"]

# Alert creation
if not isinstance(self._alerts[0]["alert_id"], int):
self._alerts[0]["alert_id"] = (
Expand All @@ -394,7 +393,6 @@ def _process_alerts(self) -> None:
)
.json()["id"]
)

# Media upload
stream = io.BytesIO()
frame_info["frame"].save(stream, format="JPEG", quality=self.jpeg_quality)
Expand All @@ -408,8 +406,9 @@ def _process_alerts(self) -> None:
self._alerts.popleft()
logging.info(f"Camera '{cam_id}' - alert sent")
stream.seek(0) # "Rewind" the stream to the beginning so we can read its content
except (KeyError, ConnectionError):
except (KeyError, ConnectionError) as e:
logging.warning(f"Camera '{cam_id}' - unable to upload cache")
logging.warning(e)
break

def _local_backup(self, img: Image.Image, cam_id: str, is_alert: bool = False) -> None:
Expand Down

0 comments on commit 94469dd

Please sign in to comment.