Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
tushar5526 committed Dec 25, 2023
0 parents commit e405486
Show file tree
Hide file tree
Showing 17 changed files with 217 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Ignore all files and folders that start with a dot.
**/*.

# Ignore all virtual envs'
venv/

# Ignore all Python bytecode files.
__pycache__/

# Ignore all temporary files.
*.tmp
*.swp

# Ignore all build artifacts.
build/
dist/

# Ignore all pyaction-related files.
README.md
CONTRIBUTING.md
CHANGELOG.md
LICENSE
Dockerfile
.env
.github/

.git/
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Testing

on:
push:
branches:
- main

jobs:
Test:
runs-on: ubuntu-latest
name: Testing the action
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Run action
uses: ./
with:
name: 'John'
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/sarthi.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# setting the base-image to alpine
FROM python:3-slim

# importing the action
COPY . /action

# installing the requirements
RUN pip install -U pip -r /action/requirements.txt

# running the main.py file
CMD [ "python", "/action/main.py" ]
8 changes: 8 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The MIT License (MIT)
Copyright (c) 2023, Tushar Gupta

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Sarthi <img alt="action-badge" src="https://img.shields.io/badge/Sarthi-white?logo=github-actions&label=GitHub%20Action&labelColor=white&color=0064D7"> <a href="https://github.com/lnxpy/cookiecutter-pyaction"><img alt="cookiecutter-pyaction" src="https://img.shields.io/badge/cookiecutter--pyaction-white?logo=cookiecutter&label=Made%20with&labelColor=white&color=0064D7"></a>

Easy to setup Docker based empheral previews!

### Usage
```yml
example usage..
```

### License
This action is licensed under some specific terms. Check [here](LICENSE) for more information.
23 changes: 23 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Sarthi
description: Easy to setup Docker based empheral previews!
author: Tushar Gupta

branding:
icon: check
color: blue

runs:
using: docker
image: Dockerfile

# == inputs and outputs ==

inputs:
name:
required: false
description: the person/thing you want to greet
default: World

outputs:
phrase:
description: output variable
Empty file added actions/__init__.py
Empty file.
23 changes: 23 additions & 0 deletions actions/io.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import os
from typing import Dict

BUFFER_PATH = os.environ["GITHUB_OUTPUT"]


def write_to_output(context: Dict[str, str]) -> None:
"""writes the keys (as variables) and values (as values) to the output buffer
Args:
context: variables and values
Examples:
In your project, use this function like:
>>> write_to_output({"name": "John", ...})
``name`` will be the variable name and ``John`` is the value.
"""

with open(BUFFER_PATH, "a") as _buffer:
for var, val in context.items():
_buffer.write(f"{var}={val}\r\n")
25 changes: 25 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os
import sys
from typing import List

from actions import io


def main(args: List[str]) -> None:
"""main function
Args:
args: STDIN arguments
"""

# now you can access the inputs like:
# f"Hello {os.environ["INPUT_NAME"]}"

# you can write to output like:
# io.write_to_output({var: val, ...})

pass


if __name__ == "__main__":
main(sys.argv[1:])
Empty file added requirements.txt
Empty file.

0 comments on commit e405486

Please sign in to comment.