Open elliot-nelson opened 3 years ago
Hey @elliot-nelson are you planning to push this in ? Or can I take it over? :)
@rjulius23 I wouldn't mind if you wanted to take it over! Unfortunately my need for the change has passed, as the pipelines we were targeting ended up moving to GitHub Actions.
SUMMARY
Add two optional parameters to the task:
ref:
, which will override the defaultGITHUB_REF
valuesha:
, which will override the defaultGITHUB_SHA
valueDETAILS
Allowing the user to specify exactly what branch name and commit SHA to pass to the Azure pipeline is necessary for workflows that trigger from non-pull-request events like
issue_comment
. For security reasons, it's impossible to override the values ofGITHUB_REF
andGITHUB_SHA
in the environment, which means for these workflows these values will always be pointing at the current tip of the default branch (e.g.main
/master
). That makes it impossible to trigger an Azure pipeline pointing at the current head branch of a pull request from an issue comment.By supporting these optional parameters, we can allow the workflow to use an inline github script or other avenue to retrieve the desired ref/sha from the event pull request, and then pass them to the Azure pipeline.
An example of what that might look like:
(This example based on the excellent comment here: https://github.com/actions/checkout/issues/331#issuecomment-707103442)