move pre cleanup to main and add pre-if and post-if #484
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is going to fix #426.
What are in this PR
pre
step from Azure Login Action and add the "pre cleanup" tomain
step.AZURE_LOGIN_PRE_CLEANUP
for checking if "cleanup before login" is necessary. By default, "cleanup before login" is disabled, only whenAZURE_LOGIN_PRE_CLEANUP
is set and is "true", "cleanup before login" will be run.AZURE_LOGIN_POST_CLEANUP
for checking if "post cleanup" is necessary. By default, "post cleanup" is enabled.Description of the issues we know about
1. If Azure CLI, PowerShell or Azure PowerShell are not pre-installed on runner but installed in the steps of the workflow, an warning will be thrown in the
pre
step. E.g., "ephemeral self-hosted runners" as metioned in #426.2.
pre cleanup
orpost cleanup
are not necessary for GitHub-hosted runners since they are always clean.pre cleanup
in a job.post cleanup
does no harm. But it's also OK if users set envAZURE_LOGIN_POST_CLEANUP
tofalse
to skippost cleanup
in case of GitHub-hosted runners.3. If Azure Login Action runs multiple times in a job, there will be multiple
pre
andpost
steps.pre
steps.post cleanup
steps are not necessary. Users can set envAZURE_LOGIN_POST_CLEANUP
totrue
for only one Azure Login Action step and set envAZURE_LOGIN_POST_CLEANUP
tofalse
for all other Azure Login Action steps.4. If there is a
if
in Azure Login Action and it doesn't match, Azure Login Action will be skipped but thepre
step will still run.5. Composite Action does not support
pre
step and will throw an warning.post
step will work well.6. Local Action (checkout the aciton and run it) does not support
pre
step and will throw an warning.post
step will work well.Reference
pre
step: Support pre and post steps in Composite Actions actions/runner#1478pre
step: Warning:pre
execution is not supported for local action from './' actions/typescript-action#564How to use