-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
- Loading branch information
There are no files selected for viewing
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/ |
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' |
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/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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" ] |
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. |
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. |
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 |
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") |
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:]) |