1
0

test composite

This commit is contained in:
yamaks2306 2022-11-23 21:29:10 +03:00
parent 30a477852c
commit f80e18d04f
3 changed files with 35 additions and 18 deletions

1
.gitignore vendored

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

@ -29,8 +29,24 @@ inputs:
required: false required: false
runs: runs:
using: 'docker' using: 'composite'
image: 'Dockerfile' 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: branding:
icon: 'send' icon: 'send'

30
main.py

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