Re-fixed github actions tag handling #3768
Merged
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.
So similar changes to this were provided in PR #3033 (fix for #2838) however the changes Azure Pipelines caused it to quickly be reverted (#3081, #3082, #3083). While I believe the Azure Pipelines issues were genuine, I don't believe the changes for Github Actions had any issues (that I'm aware of) however it currently causes mass headache when trying to push preview releases.
This change reintroduces only the github action changes. I suspect the changes to Gitlab and others might still apply, however I would rather they get added as separate PRs in the event that one of them triggers another revert.
Description
Updates the
GitHubActions
build agent to properly handle both tag builds and pull request builds based on the github actions docs.See: https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
Related Issue
#2838, #3033, #3653
Motivation and Context
Today github actions cannot properly create a tagged preview build because the version comes out and some form of 1.5.0-tags-v1-5-0-preview-6.1 where the real base branch is not properly detected
How Has This Been Tested?
Changes are based off the original PR with some changes based on additional environment variables that exist in a Github Action Runner environment (event name, ref type, head ref, etc)
Screenshots (if appropriate):
Checklist: