-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6dea2b
commit 8f07e59
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# .github/workflows/test_action.yaml | ||
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: ./ # Uses an action in the root directory | ||
# or use a released GitHub Action | ||
# uses: shipyard/github-action/[email protected] | ||
with: | ||
num: 11 | ||
- name: Print the square | ||
run: echo "${{ steps.get_square.outputs.num_squared }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# action.yaml | ||
name: 'Custom GitHub Action' | ||
description: 'A GitHub Action that takes an input and returns the square of the number' | ||
inputs: | ||
num: | ||
description: 'Enter a number' | ||
required: true | ||
default: "1" | ||
outputs: | ||
num_squared: | ||
description: 'Square of the input' | ||
# need to specify the extra `value` field for `composite` actions | ||
value: ${{ steps.get-square.outputs.num_squared }} | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Install Dependencies | ||
run: pip install -r requirements.txt | ||
shell: bash | ||
- name: Pass Inputs to Shell | ||
run: | | ||
echo "INPUT_NUM=${{ inputs.num }}" >> $GITHUB_ENV | ||
shell: bash | ||
- name: Fetch the number's square | ||
id: get-square | ||
run: python src/get_num_square.py | ||
shell: bash |