diff --git a/Dockerfile b/Dockerfile index b1bfe25..3de807b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,8 @@ COPY ./requirements.txt ./requirements.txt RUN pip install --upgrade pip && pip install -r ./requirements.txt -COPY ./main.py ./main.py -COPY ./entrypoint.sh ./entrypoint.sh +WORKDIR /action -ENTRYPOINT ["./entrypoint.sh"] +COPY ./main.py ./main.py + +ENTRYPOINT ["python", "/action/main.py"] diff --git a/entrypoint.sh b/entrypoint.sh deleted file mode 100644 index 8cbe8a3..0000000 --- a/entrypoint.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -python ./main.py "$@" diff --git a/main.py b/main.py index a37df2f..a664bec 100644 --- a/main.py +++ b/main.py @@ -70,7 +70,7 @@ if __name__ == "__main__": ], ) - if message_id is not None: + if message_id: previous_message_data = httpx.get(f"{webhook_url}/messages/{message_id}").json() response = httpx.patch( @@ -82,7 +82,10 @@ if __name__ == "__main__": response = httpx.post(f"{webhook_url}?wait=true", json={"embeds": [embed_data]}) message_id = response.json()["id"] - outputs_path = os.environ.get("GITHUB_ENV") + outputs_path = os.environ.get("GITHUB_OUTPUT") + + if not outputs_path: + raise RuntimeError("Cannot write to outputs, no GITHUB_ENV set.") with open(outputs_path, "a", encoding="utf-8") as outputs_file: - outputs_file.write(f"message-id={message_id}") + outputs_file.write(f"message-id={message_id}\n")