From bca5a8d838913820c8e395c40fd76e6698337276 Mon Sep 17 00:00:00 2001 From: DSLKD <127169366+DSLKD@users.noreply.github.com> Date: Tue, 4 Apr 2023 12:31:48 +0900 Subject: [PATCH 1/4] Create get_num_square.py --- src/get_num_square.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/get_num_square.py 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}") From 127210d050eb78a9440a3141bff09c2f2a48a097 Mon Sep 17 00:00:00 2001 From: DSLKD <127169366+DSLKD@users.noreply.github.com> Date: Tue, 4 Apr 2023 12:46:55 +0900 Subject: [PATCH 2/4] Create main.yml --- .github/workflows/main.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..17f2315fc --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,17 @@ +name: Test Action +on: [push] + +jobs: + get-num-suqare: + runs-on: ubuntu-latest + name: Returns the number square + steps: + - name: Checkout + uses: action/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}}" From ca39b51319b29b4e8e077842a247229682febe21 Mon Sep 17 00:00:00 2001 From: DSLKD <127169366+DSLKD@users.noreply.github.com> Date: Tue, 4 Apr 2023 12:48:08 +0900 Subject: [PATCH 3/4] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 17f2315fc..f72f32506 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: uses: action/checkout@v2 - name: Fetch num squared id: get_square - uses: ./ + uses: ./ # Uses an action in the root directory with: num: 11 - name: Print the square From 88f5c84c55023f3accad7bb07e626a0dc537ef22 Mon Sep 17 00:00:00 2001 From: DSLKD <127169366+DSLKD@users.noreply.github.com> Date: Tue, 4 Apr 2023 12:49:22 +0900 Subject: [PATCH 4/4] Update main.yml --- .github/workflows/main.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f72f32506..1104bfbf3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,16 +2,16 @@ name: Test Action on: [push] jobs: - get-num-suqare: - runs-on: ubuntu-latest - name: Returns the number square - steps: - - name: Checkout - uses: action/checkout@v2 - - name: Fetch num squared - id: get_square - uses: ./ # Uses an action in the root directory - with: - num: 11 - - name: Print the square + 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}}"