Skip to content

Commit 94469dd

Browse files
authored
GitAction should not be launched if a PR is closed but not merged (#192)
* fix(gitAction): should not be launched if a PR is closed but not merged * improve logging
1 parent 25bd5ad commit 94469dd

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

.github/workflows/build-push-image.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
name: Build and Push Docker Image
22

33
on:
4-
pull_request:
5-
types: [closed]
6-
branches:
7-
- develop
84
push:
95
branches:
106
- develop

pyroengine/engine.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,6 @@ def _process_alerts(self) -> None:
381381
# Media creation
382382
if not isinstance(self._alerts[0]["media_id"], int):
383383
self._alerts[0]["media_id"] = self.api_client[cam_id].create_media_from_device().json()["id"]
384-
385384
# Alert creation
386385
if not isinstance(self._alerts[0]["alert_id"], int):
387386
self._alerts[0]["alert_id"] = (
@@ -394,7 +393,6 @@ def _process_alerts(self) -> None:
394393
)
395394
.json()["id"]
396395
)
397-
398396
# Media upload
399397
stream = io.BytesIO()
400398
frame_info["frame"].save(stream, format="JPEG", quality=self.jpeg_quality)
@@ -408,8 +406,9 @@ def _process_alerts(self) -> None:
408406
self._alerts.popleft()
409407
logging.info(f"Camera '{cam_id}' - alert sent")
410408
stream.seek(0) # "Rewind" the stream to the beginning so we can read its content
411-
except (KeyError, ConnectionError):
409+
except (KeyError, ConnectionError) as e:
412410
logging.warning(f"Camera '{cam_id}' - unable to upload cache")
411+
logging.warning(e)
413412
break
414413

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

0 commit comments

Comments
 (0)