Add optional parameters ref and sha#23
Open
elliot-nelson wants to merge 2 commits intoAzure:masterfrom
Open
Conversation
- Specify optional `ref:` parameter to override GITHUB_REF - Specify optional `sha:` parameter to override GITHUB_SHA
…sing pipeline name.
|
Hey @elliot-nelson are you planning to push this in ? Or can I take it over? :) |
Author
|
@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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
SUMMARY
Add two optional parameters to the task:
ref:, which will override the defaultGITHUB_REFvaluesha:, which will override the defaultGITHUB_SHAvalueDETAILS
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_REFandGITHUB_SHAin 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: actions/checkout#331 (comment))