-
Notifications
You must be signed in to change notification settings - Fork 967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explicitly define what is allowed for a composite action #605
Explicitly define what is allowed for a composite action #605
Conversation
Tested if the defaults shell and working-dir values override the composite action steps' shell and working-dir. They do not override the steps inside of a composite action's shell or working-dir. This is want we want because we want the workflow to have no influence over the composite action in terms of defaults. Why does this already work? We don't check the
cc @ericsciple |
…or composite action
Originally had planned to just null the ExectionContext.Global.JobDefaults for each composite action step ]'s ExecutionContext but this would have nullified all .Global.JobDefaults since we share the same pointer to Global for every instance of ExecutionContext. So, I think my |
…andler for composite action" This reverts commit aeae15d.
Reverting changes - if we change the run defaults logic in the future, we'll change it then. |
example of if not being allowed: https://github.com/ethanchewy/testing-actions/runs/895611092?check_suite_focus=true (all others should not work too like "needs", etc.) |
|
…bute which is only found in the ActionStep not IStep
|
Thought there was a bug with setting the working-dir and shell but it works as intended (it was a bug with my test :/). Reverting back to original code. |
… ScriptHandler for composite action"" This reverts commit a22fcbc.
Ready for review. |
(leaving this unmerged till @ericsciple has the chance to look at it since this is a really important PR) |
@@ -120,7 +120,22 @@ | |||
"hashFiles(1,255)" | |||
], | |||
"sequence": { | |||
"item-type": "any" | |||
"item-type": "composite-step" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have validation on the server that at least one step is required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ericsciple For server side,
- If there are no "steps" token used, it handles it: https://github.com/ethanchewy/testing-actions/runs/898870893?check_suite_focus=true.
- If there are no steps within the "steps" token, the user will get an unexpected value from the server side: https://github.com/ethanchewy/testing-actions/runs/898862578?check_suite_focus=true
…thanchewy/compositeRestrictUnknownBehavior
@@ -108,19 +108,26 @@ | |||
} | |||
}, | |||
"composite-steps": { | |||
"context": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the attribute needs a context, they'll have access (see "string-steps-context")
Ready for final review. (tested all edge cases [see description for links]). |
* Explicitly define what is allowed for an action * Add step-env * Remove secrets + defaults * new line * Add safety check to prevent from checking defaults in ScriptHandler for composite action * Revert "Add safety check to prevent from checking defaults in ScriptHandler for composite action" This reverts commit aeae15d. * Need to explictly use ActionStep type since we need the .Inputs attribute which is only found in the ActionStep not IStep * Fix ActionManifestManager * Remove todos * Revert "Revert "Add safety check to prevent from checking defaults in ScriptHandler for composite action"" This reverts commit a22fcbc. * revert * Remove needs in env * Make shell required + add inputs * Remove passing context to all composite steps attribuyte
* Explicitly define what is allowed for an action * Add step-env * Remove secrets + defaults * new line * Add safety check to prevent from checking defaults in ScriptHandler for composite action * Revert "Add safety check to prevent from checking defaults in ScriptHandler for composite action" This reverts commit aeae15d. * Need to explictly use ActionStep type since we need the .Inputs attribute which is only found in the ActionStep not IStep * Fix ActionManifestManager * Remove todos * Revert "Revert "Add safety check to prevent from checking defaults in ScriptHandler for composite action"" This reverts commit a22fcbc. * revert * Remove needs in env * Make shell required + add inputs * Remove passing context to all composite steps attribuyte
* Explicitly define what is allowed for an action * Add step-env * Remove secrets + defaults * new line * Add safety check to prevent from checking defaults in ScriptHandler for composite action * Revert "Add safety check to prevent from checking defaults in ScriptHandler for composite action" This reverts commit aeae15d. * Need to explictly use ActionStep type since we need the .Inputs attribute which is only found in the ActionStep not IStep * Fix ActionManifestManager * Remove todos * Revert "Revert "Add safety check to prevent from checking defaults in ScriptHandler for composite action"" This reverts commit a22fcbc. * revert * Remove needs in env * Make shell required + add inputs * Remove passing context to all composite steps attribuyte
* Explicitly define what is allowed for an action * Add step-env * Remove secrets + defaults * new line * Add safety check to prevent from checking defaults in ScriptHandler for composite action * Revert "Add safety check to prevent from checking defaults in ScriptHandler for composite action" This reverts commit aeae15d. * Need to explictly use ActionStep type since we need the .Inputs attribute which is only found in the ActionStep not IStep * Fix ActionManifestManager * Remove todos * Revert "Revert "Add safety check to prevent from checking defaults in ScriptHandler for composite action"" This reverts commit a22fcbc. * revert * Remove needs in env * Make shell required + add inputs * Remove passing context to all composite steps attribuyte
In this PR, we explicitly define what is allowed for our composite action feature.
For each composite run step, we explicitly remove support for
if
,timeout-minutes
, andcontinue-on-error
. We'll support,id
,shell
,run
,working-directory
, andenv
all of which are optional except forrun
.We don't want the defaults to flow to the composite action. Here is proof of them not flowing: https://github.com/ethanchewy/testing-actions/runs/895343022?check_suite_focus=true
Here is an example of the step level
working-directory
andenv
working: https://github.com/ethanchewy/testing-actions/runs/896147997?check_suite_focus=trueShell requirement: https://github.com/ethanchewy/testing-actions/actions/runs/184525896
Example outputs demo working with explicit parameters: https://github.com/ethanchewy/testing-actions/runs/915495023?check_suite_focus=true
ID Context Expressions Not Allowed: https://github.com/ethanchewy/testing-actions/actions/runs/184536224, https://github.com/ethanchewy/testing-actions/actions/runs/184534064
Shell expression not allowed: https://github.com/ethanchewy/testing-actions/runs/915600890