Skip to content

Commit 3a705e7

Browse files
authored
Merge pull request #17 from openziti/fix-loading
fix loading of ziti identity
2 parents a8cc813 + fdd686a commit 3a705e7

File tree

4 files changed

+28
-10
lines changed

4 files changed

+28
-10
lines changed

.github/workflows/python.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ jobs:
55
name: Lint
66
runs-on: ubuntu-latest
77
steps:
8-
- name: Set up Python 3.10
9-
uses: actions/setup-python@v1
8+
- name: Set up Python 3.12
9+
uses: actions/setup-python@v5
1010
with:
11-
python-version: "3.10"
11+
python-version: "3.12"
1212

13-
- uses: actions/checkout@v1
13+
- uses: actions/checkout@v4
1414

1515
- name: Lint
1616
run: |

.github/workflows/zhook.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,26 @@ jobs:
2020
runs-on: ubuntu-latest
2121
name: POST Webhook
2222
steps:
23-
- uses: actions/checkout@v1
23+
- uses: actions/checkout@v4
24+
- name: run hook directly
25+
if: |
26+
github.repository_owner == 'openziti'
27+
&& ((github.event_name != 'pull_request_review')
28+
|| (github.event_name == 'pull_request_review' && github.event.review.state == 'approved'))
29+
env:
30+
INPUT_ZITIID: ${{ secrets.ZITI_MATTERMOST_IDENTITY }}
31+
INPUT_WEBHOOKURL: ${{ secrets.ZHOOK_URL }}
32+
INPUT_EVENTJSON: ${{ toJson(github.event) }}
33+
INPUT_SENDERUSERNAME: GitHubZ
34+
INPUT_DESTCHANNEL: dev-notifications
35+
INPUT_SENDERICONURL: https://github.com/fluidicon.png
36+
run: |
37+
pip install --upgrade requests openziti
38+
python ./zhook.py
39+
40+
2441
- uses: ./ # use self to bring the pain forward
42+
name: run action
2543
if: |
2644
github.repository_owner == 'openziti'
2745
&& ((github.event_name != 'pull_request_review')

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ FROM python:3-slim AS builder
22
ADD . /app
33
WORKDIR /app
44

5-
RUN pip install --target=/app requests openziti==0.7.2
5+
RUN pip install --target=/app requests openziti
66

77
# https://github.com/GoogleContainerTools/distroless
8-
FROM gcr.io/distroless/python3-debian10
8+
FROM gcr.io/distroless/python3-debian12
99
COPY --from=builder /app /app
1010
WORKDIR /app
1111
ENV PYTHONPATH /app

zhook.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def createTitle(self):
8686
# starCount = self.repoJson["stargazers_count"]
8787
# starUrl = f"{repoUrl}/stargazers"
8888

89-
title = f"{self.eventName.capitalize().replace('_',' ')}"
89+
title = f"{self.eventName.capitalize().replace('_', ' ')}"
9090

9191
try:
9292
action = self.eventJson["action"]
@@ -344,7 +344,7 @@ def addWatchDetails(self):
344344
def addDefaultDetails(self):
345345
self.attachment["color"] = self.todoColor
346346
self.attachment["text"] = self.createTitle()
347-
self.attachment["fallback"] = f"{eventName.capitalize().replace('_',' ')} by {self.senderJson['login']} in {self.repoJson['full_name']}"
347+
self.attachment["fallback"] = f"{eventName.capitalize().replace('_', ' ')} by {self.senderJson['login']} in {self.repoJson['full_name']}"
348348

349349
def dumpJson(self):
350350
return json.dumps(self.body)
@@ -362,9 +362,9 @@ def dumpJson(self):
362362

363363
# Setup Ziti identity
364364
idFilename = "id.json"
365-
os.environ["ZITI_IDENTITIES"] = idFilename
366365
with open(idFilename, 'w') as f:
367366
f.write(zitiId)
367+
openziti.load(idFilename)
368368

369369
# Create webhook body
370370
try:

0 commit comments

Comments
 (0)