File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,13 @@ jobs:
113113 repository : ["ZestCommunity/ZestCode"]
114114 ref : ["main"]
115115 caller_token : ["${{ github.token }}"]
116+ clone_repo : [true, false] # false tests setup command
117+ expect_error : [false, true]
118+ exclude :
119+ # We only really need to test if the action fails the setup command in one case
120+ - write_job_summary : false
121+ clone_repo : false
122+
116123 with :
117124 write_job_summary : ${{ matrix.write_job_summary }}
118125 repository : ${{ matrix.repository }}
Original file line number Diff line number Diff line change 1818 description : Whether to write the artifact URL to the job summary
1919 default : true
2020 type : boolean
21+ clone_repo :
22+ description : Whether to clone the repo
23+ default : true
24+ type : boolean
25+ expect_error :
26+ description : Whether to expect an error
27+ default : false
28+ type : boolean
2129
2230jobs :
2331 test :
2432 name : " Testing Container: Write Job Summary?${{ inputs.write_job_summary }}"
2533 runs-on : ubuntu-latest
2634 steps :
27- - name : Checkout
35+ - name : Checkout Repository to Test
2836 uses : actions/checkout@v4
37+ if : ${{ inputs.clone_repo }}
2938 with :
3039 repository : ${{ inputs.repository }}
3140 ref : ${{ inputs.ref }}
3241
33- - name : Checkout
42+ - name : Checkout Action
3443 uses : actions/checkout@v4
3544 with :
3645 path : ./action/
5564 - name : Test Action
5665 id : test-action
5766 uses : ./action/
58- continue-on-error : False
67+ continue-on-error : ${{ inputs.expect_error }}
5968 with :
6069 write_job_summary : ${{ inputs.write_job_summary }}
70+
71+ - name : Check for Failure If Expected
72+ if : ${{ inputs.expect_error }}
73+ run : |
74+ if [ "${{ (steps.test-action.outcome == 'success') }}" == "true" ]; then
75+ echo "Test Action step succeeded when it was expected to fail. Failing job.."
76+ exit 1
77+ else
78+ echo "Test Action step failed as expected."
79+ fi
You can’t perform that action at this time.
0 commit comments