1
0

Merge pull request #5 from yamaks2306/dev

Switch to composite actions
This commit is contained in:
yamaks2306 2022-11-23 23:16:16 +03:00 committed by GitHub
commit fc9dcbdc5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 24 deletions

3
.gitignore vendored

@ -1,2 +1,3 @@
__pycache__/
.testenvs
.testenvs
.vscode/

@ -1,4 +0,0 @@
FROM python:3.10-slim
COPY . /
RUN python -m pip install requests
ENTRYPOINT ["/entrypoint.sh"]

@ -29,8 +29,24 @@ inputs:
required: false
runs:
using: 'docker'
image: 'Dockerfile'
using: 'composite'
steps:
- shell: bash
run: python3 ${{ github.action_path }}/main.py
env:
CHAT_ID: ${{ inputs.chat_id }}
TOKEN: ${{ inputs.token }}
STATUS: ${{ inputs.status }}
COMMIT_MESSAGE: ${{ inputs.commit_message }}
DOCKER_TAGS: ${{ inputs.docker_tags }}
INCLUDE_COMMIT_INFO: ${{ inputs.include_commit_info }}
MESSAGE: ${{ inputs.message }}
WORKFLOW: ${{ github.workflow }}
REPOSITORY: ${{ github.repository }}
SHA: ${{ github.sha }}
ACTOR: ${{ github.actor }}
TAG: ${{ github.ref }}
branding:
icon: 'send'

@ -1,2 +0,0 @@
#!/bin/bash
python /main.py

30
main.py

@ -2,23 +2,23 @@ import os
from message import Message
from environments import Environment
chat_id = os.getenv('INPUT_CHAT_ID')
if chat_id == "":
chat_id = os.getenv('CHAT_ID')
if chat_id == "" or chat_id is None:
raise SystemExit('Variable chat_id is required. Exit.')
token = os.getenv('INPUT_TOKEN')
if token == "":
raise SystemExit('Variable chat_id is required. Exit.')
status = os.getenv('INPUT_STATUS')
commit = os.getenv('INPUT_COMMIT_MESSAGE')
include_commit_info = os.getenv('INPUT_INCLUDE_COMMIT_INFO')
docker_tags = os.getenv('INPUT_DOCKER_TAGS')
custom_message = os.getenv('INPUT_MESSAGE')
token = os.getenv('TOKEN')
if token == "" or token is None:
raise SystemExit('Variable token is required. Exit.')
status = os.getenv('STATUS')
commit = os.getenv('COMMIT_MESSAGE')
include_commit_info = os.getenv('INCLUDE_COMMIT_INFO')
docker_tags = os.getenv('DOCKER_TAGS')
custom_message = os.getenv('MESSAGE')
#GitHub environment variables
github_workflow = os.getenv('GITHUB_WORKFLOW')
github_repository = os.getenv('GITHUB_REPOSITORY')
github_sha = os.getenv('GITHUB_SHA')
github_actor = os.getenv('GITHUB_ACTOR')
tag = os.getenv('GITHUB_REF')
github_workflow = os.getenv('WORKFLOW')
github_repository = os.getenv('REPOSITORY')
github_sha = os.getenv('SHA')
github_actor = os.getenv('ACTOR')
tag = os.getenv('TAG')
envs = Environment(
chat_id,