Implement git-push-changes.yml in PowerShell or other language
- Dominant language
- C#
- Stars
- 135
- Forks
- 260
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 115
Description
The steps in [`git-push-changes.yml`](https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/pipelines/templates/steps/git-push-changes.yml) are implemented in a way that is less flexible than the template is currently used.
In vcpkg publishing scenarios, we're using the script to push changes to a branch which already has commits (no need to check for changes) and in cases where we need to force push existing changes to a branch.
in `git-push-changes.yml` template-time and runtime checks are used to determine whether to check for changes AND execute `git-branch-push.ps1` ... In its current implementation it's impossible to set a value for `SkipCheckingForChanges` (or any other such template parameter) at runtime (i.e. using macro syntax like `$(VariableName)`). The result is that we must work around the existing implementation by doing 2 things:
1. Set the pipeline variable `HasChanges` to `true`
2. Set `SkipCheckingForChanges` to `true` in the template invocation
Instead, the interface could look like:
```
- template: /eng/common/pipelines/templates/steps/git-push-changes.yml
parameters:
BaseRepoBranch: base-branch
BaseRepoOwner: azure-sdk
CommitMsg: Some commit message
PushArgs: -f
# Use whatever the runtime value of this variable is to decide whether to attempt a push
PushRegardlessOfWorkingDirectoryCommitStatus: $(SomeRuntimeVariable)
```
`git-push-changes.yml` would have 1 less step (no more checking for changes) and would instead perform the change checking within the logic of the script.
Also, removing repo owner from the repo name can be accomplished by running the same logic inside of the same push script.
Contributor guide
Assessment
This issue has not been assessed yet.