fix: Fix git-sha value for the GitLab when merge strategy doesn't cre… #570
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.
Description
This PR fixes an issue where GitLab webhook payloads return
nullformerge_commit_shawhen using fast-forward or squash merge strategies, causing build pipelines to fail. The fix changes the triggerbinding to useextensions.pullRequest.headShainstead, which correctly maps to thelast_commit.idfield that is always available in GitLab merge request webhooks.Fixes #569
Type of change
How Has This Been Tested?
Tested with GitLab merge request events in an environment configured with fast-forward merge strategy. Verified that the TriggerBinding now correctly extracts the commit SHA from
extensions.pullRequest.headSha, which is populated by the interceptor from thelast_commit.idfield in the webhook payload.Checklist:
Screenshots (if appropriate):
N/A
Additional context
The GitLab API documentation states that
merge_commit_shareturnsnulluntil the MR is merged, and remainsnullfor fast-forward merge strategies. Thelast_commit.idfield is always available and represents the head commit of the merge request, making it the reliable choice for triggering build pipelines on merge request events.