diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..1104bfbf3 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,17 @@ +name: Test Action +on: [push] + +jobs: + get-num-square: + runs-on: ubuntu-latest + name: Returns the number square + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Fetch num squared + id: get_square + uses: ./ + with: + num: 11 + - name: Print the square + run: echo "${{steps.get_square.outputs.num_squared}}" diff --git a/src/get_num_square.py b/src/get_num_square.py new file mode 100644 index 000000000..341acefb9 --- /dev/null +++ b/src/get_num_square.py @@ -0,0 +1,12 @@ +import os +num = os.environ.get("INPUT_NUM") +if num: + try: + num = int(num) + except Exception: + exit() + + else: + num = 1 + + print(f"::set-output name=num_squared::{num**2}")